Skip to content

Commit

Permalink
Remove unnecessary/duplicated includes.
Browse files Browse the repository at this point in the history
In particular sys/time.h is included in a lot
of places that do not need or need it only
when specific defines are set.
Besides being cleaner this should also be
better for portability, though there is a
risk of it breaking something on some
less common systems.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@38242 b3059339-0415-0410-9bf9-f77b7e298cf2
  • Loading branch information
reimar committed Jan 25, 2021
1 parent 9394a37 commit 6d6ad02
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 23 deletions.
2 changes: 2 additions & 0 deletions input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_POSIX_SELECT
#include <sys/time.h>
#endif
#include <fcntl.h>
#include <ctype.h>

Expand Down
1 change: 0 additions & 1 deletion libao2/ao_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/

#include <errno.h>
#include <sys/time.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
Expand Down
14 changes: 10 additions & 4 deletions libmenu/menu_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@
#include "mp_msg.h"
#include "help_mp.h"

#ifdef HAVE_POSIX_SELECT
#define RUN_CMD 1
#else
#define RUN_CMD 0
#endif

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <sys/types.h>
#ifndef __MINGW32__
#if RUN_CMD
#include <sys/wait.h>
#include <sys/time.h>
#endif
#include <unistd.h>
#include <errno.h>
Expand Down Expand Up @@ -241,7 +247,7 @@ static void draw(menu_t* menu, mp_image_t* mpi) {
}

static void check_child(menu_t* menu) {
#ifndef __MINGW32__
#if RUN_CMD
fd_set rfd;
struct timeval tv;
int max_fd = mpriv->child_fd[2] > mpriv->child_fd[1] ? mpriv->child_fd[2] :
Expand Down Expand Up @@ -295,7 +301,7 @@ static void check_child(menu_t* menu) {
#define close_pipe(pipe) close(pipe[0]); close(pipe[1])

static int run_shell_cmd(menu_t* menu, char* cmd) {
#ifndef __MINGW32__
#if RUN_CMD
int in[2],out[2],err[2];

mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ConsoleRun,cmd);
Expand Down
6 changes: 2 additions & 4 deletions libmpcodecs/vf_filmdint.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>

#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
#include "osdep/timer.h"

#include "img_format.h"
#include "mp_image.h"
Expand Down Expand Up @@ -927,9 +927,7 @@ static void init(struct vf_priv_s *p, mp_image_t *mpi)

static inline double get_time(void)
{
struct timeval tv;
gettimeofday(&tv, 0);
return tv.tv_sec + tv.tv_usec * 1e-6;
return GetTimer() * 1e-6;
}

static void get_image(struct vf_instance *vf, mp_image_t *mpi)
Expand Down
1 change: 0 additions & 1 deletion mencoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#if defined(__MINGW32__) || defined(__CYGWIN__)
#include <windows.h>
#endif
Expand Down
3 changes: 0 additions & 3 deletions mplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <unistd.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>

#if defined(__MINGW32__) || defined(__CYGWIN__)
Expand Down Expand Up @@ -123,8 +122,6 @@
#include "sub/subreader.h"
#include "sub/vobsub.h"
#include "sub/eosd.h"
#include "osdep/getch2.h"
#include "osdep/timer.h"

#include "udp_sync.h"

Expand Down
1 change: 0 additions & 1 deletion stream/freesdp/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
# define END_C_DECLS
#endif /* __cplusplus */

#include <sys/time.h>
#include <time.h>

BEGIN_C_DECLS
Expand Down
1 change: 0 additions & 1 deletion stream/frequencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/

#include <stdlib.h>
#include <sys/time.h>

#include "frequencies.h"

Expand Down
2 changes: 1 addition & 1 deletion stream/librtsp/rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <inttypes.h>
#if HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#include <sys/time.h>
#include <sys/socket.h>
#endif
#include "libavutil/avstring.h"
Expand Down
2 changes: 1 addition & 1 deletion stream/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#define MPLAYER_NETWORK_H

#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>

#include "config.h"
#if !HAVE_WINSOCK2_H
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion stream/pnm.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/time.h>
#include <inttypes.h>
#if !HAVE_WINSOCK2_H
#include <sys/socket.h>
#include <sys/time.h>
//#include <netinet/in.h>
//#include <netdb.h>
#else
Expand Down
1 change: 0 additions & 1 deletion stream/stream_dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <string.h>
#include <ctype.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <poll.h>
#include <unistd.h>
#include <fcntl.h>
Expand Down
1 change: 0 additions & 1 deletion stream/stream_pvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <fcntl.h>
Expand Down
2 changes: 1 addition & 1 deletion stream/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <ctype.h>

#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>

#include "config.h"
Expand All @@ -42,6 +41,7 @@
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#else
#include <winsock2.h>
Expand Down
1 change: 0 additions & 1 deletion stream/tv.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>

#include "config.h"

Expand Down
2 changes: 1 addition & 1 deletion stream/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/time.h>
#include <ctype.h>

#if !HAVE_WINSOCK2_H
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#else
#include <winsock2.h>
Expand Down

0 comments on commit 6d6ad02

Please sign in to comment.