[MPlayer-cvslog] r38242 - in trunk: input/input.c libao2/ao_alsa.c libmenu/menu_console.c libmpcodecs/vf_filmdint.c mencoder.c mplayer.c stream/freesdp/common.h stream/frequencies.c stream/librtsp/rtsp.c stream/net...

reimar subversion at mplayerhq.hu
Mon Jan 25 21:10:33 EET 2021


Author: reimar
Date: Mon Jan 25 21:10:32 2021
New Revision: 38242

Log:
Remove unnecessary/duplicated includes.

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.

Modified:
   trunk/input/input.c
   trunk/libao2/ao_alsa.c
   trunk/libmenu/menu_console.c
   trunk/libmpcodecs/vf_filmdint.c
   trunk/mencoder.c
   trunk/mplayer.c
   trunk/stream/freesdp/common.h
   trunk/stream/frequencies.c
   trunk/stream/librtsp/rtsp.c
   trunk/stream/network.h
   trunk/stream/pnm.c
   trunk/stream/stream_dvb.c
   trunk/stream/stream_pvr.c
   trunk/stream/tcp.c
   trunk/stream/tv.c
   trunk/stream/udp.c

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/input/input.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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>
 

Modified: trunk/libao2/ao_alsa.c
==============================================================================
--- trunk/libao2/ao_alsa.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/libao2/ao_alsa.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -27,7 +27,6 @@
  */
 
 #include <errno.h>
-#include <sys/time.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <ctype.h>

Modified: trunk/libmenu/menu_console.c
==============================================================================
--- trunk/libmenu/menu_console.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/libmenu/menu_console.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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>
@@ -241,7 +247,7 @@ static void draw(menu_t* menu, mp_image_
 }
 
 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] :
@@ -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);

Modified: trunk/libmpcodecs/vf_filmdint.c
==============================================================================
--- trunk/libmpcodecs/vf_filmdint.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/libmpcodecs/vf_filmdint.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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"
@@ -927,9 +927,7 @@ static void init(struct vf_priv_s *p, mp
 
 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)

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/mencoder.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/mplayer.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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__)
@@ -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"
 

Modified: trunk/stream/freesdp/common.h
==============================================================================
--- trunk/stream/freesdp/common.h	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/freesdp/common.h	Mon Jan 25 21:10:32 2021	(r38242)
@@ -35,7 +35,6 @@
 #  define END_C_DECLS
 #endif /* __cplusplus */
 
-#include <sys/time.h>
 #include <time.h>
 
 BEGIN_C_DECLS

Modified: trunk/stream/frequencies.c
==============================================================================
--- trunk/stream/frequencies.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/frequencies.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -17,7 +17,6 @@
  */
 
 #include <stdlib.h>
-#include <sys/time.h>
 
 #include "frequencies.h"
 

Modified: trunk/stream/librtsp/rtsp.c
==============================================================================
--- trunk/stream/librtsp/rtsp.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/librtsp/rtsp.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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"

Modified: trunk/stream/network.h
==============================================================================
--- trunk/stream/network.h	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/network.h	Mon Jan 25 21:10:32 2021	(r38242)
@@ -24,7 +24,6 @@
 #define MPLAYER_NETWORK_H
 
 #include <fcntl.h>
-#include <sys/time.h>
 #include <sys/types.h>
 
 #include "config.h"
@@ -32,6 +31,7 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
+#include <sys/time.h>
 #include <arpa/inet.h>
 #endif
 

Modified: trunk/stream/pnm.c
==============================================================================
--- trunk/stream/pnm.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/pnm.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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

Modified: trunk/stream/stream_dvb.c
==============================================================================
--- trunk/stream/stream_dvb.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/stream_dvb.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fi
 #include <string.h>
 #include <ctype.h>
 #include <sys/ioctl.h>
-#include <sys/time.h>
 #include <poll.h>
 #include <unistd.h>
 #include <fcntl.h>

Modified: trunk/stream/stream_pvr.c
==============================================================================
--- trunk/stream/stream_pvr.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/stream_pvr.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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>

Modified: trunk/stream/tcp.c
==============================================================================
--- trunk/stream/tcp.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/tcp.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -30,7 +30,6 @@
 #include <ctype.h>
 
 #include <fcntl.h>
-#include <sys/time.h>
 #include <sys/types.h>
 
 #include "config.h"
@@ -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>

Modified: trunk/stream/tv.c
==============================================================================
--- trunk/stream/tv.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/tv.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -30,7 +30,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <ctype.h>
-#include <sys/time.h>
 
 #include "config.h"
 

Modified: trunk/stream/udp.c
==============================================================================
--- trunk/stream/udp.c	Mon Jan 25 21:10:28 2021	(r38241)
+++ trunk/stream/udp.c	Mon Jan 25 21:10:32 2021	(r38242)
@@ -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>


More information about the MPlayer-cvslog mailing list