]> git.sesse.net Git - vlc/commitdiff
Use macros rather than overkill APIs
authorRémi Denis-Courmont <rem@videolan.org>
Fri, 1 Jul 2005 14:48:29 +0000 (14:48 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Fri, 1 Jul 2005 14:48:29 +0000 (14:48 +0000)
include/network.h
include/vlc_symbols.h
src/misc/net.c

index b6e53993b1d9b6646d42085c722cf1f2af023ac4..be12a7c797257f1f81c143dea09488e42005cdae 100644 (file)
@@ -343,8 +343,24 @@ VLC_EXPORT( int, net_Printf, ( vlc_object_t *p_this, int fd, v_socket_t *, const
 #define net_vaPrintf(a,b,c,d,e) __net_vaPrintf(VLC_OBJECT(a),b,c,d,e)
 VLC_EXPORT( int, __net_vaPrintf, ( vlc_object_t *p_this, int fd, v_socket_t *, const char *psz_fmt, va_list args ) );
 
-VLC_EXPORT( int, net_StopRecv, ( int fd ) );
-VLC_EXPORT( int, net_StopSend, ( int fd ) );
+/*****************************************************************************
+ * net_StopRecv/Send
+ *****************************************************************************
+ * Wrappers for shutdown()
+ *****************************************************************************/
+#if defined (SHUT_WR)
+/* the standard way */
+# define net_StopSend( fd ) shutdown( fd, SHUT_WR )
+# define net_StopRecv( fd ) shutdown( fd, SHUT_RD )
+#elif defined (SD_SEND)
+/* the Microsoft seemingly-purposedly-different-for-the-sake-of-it way */
+# define net_StopSend( fd ) shutdown( fd, SD_SEND )
+# define net_StopRecv( fd ) shutdown( fd, SD_RECEIVE )
+#else
+# warning FIXME: implement shutdown on your platform!
+# define net_StopSend( fd ) void(0)
+# define net_StopRecv( fd ) void(0)
+#endif
 
 #define net_CheckIP(a,b,c,d) __net_CheckIP(VLC_OBJECT(a),b,c,d)
 VLC_EXPORT( int, __net_CheckIP, ( vlc_object_t *p_this, char *psz_ip, char **ppsz_hosts, int i_hosts ) );
index d726fe57ab4438348fffb0c6614ef88c7bec563f..a5622faa846b99f5c12b821ac7bf11fdf94b67c4 100644 (file)
@@ -376,8 +376,6 @@ struct module_symbols_t
     void (*net_ListenClose_inner) (int *fd);
     void (*DigestMD5_inner) (struct md5_s *, uint32_t *);
     int (*__net_CheckIP_inner) (vlc_object_t *p_this, char *psz_ip, char **ppsz_hosts, int i_hosts);
-    int (*net_StopSend_inner) (int fd);
-    int (*net_StopRecv_inner) (int fd);
 };
 # if defined (__PLUGIN__)
 #  define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
@@ -739,8 +737,6 @@ struct module_symbols_t
 #  define net_ListenClose (p_symbols)->net_ListenClose_inner
 #  define DigestMD5 (p_symbols)->DigestMD5_inner
 #  define __net_CheckIP (p_symbols)->__net_CheckIP_inner
-#  define net_StopSend (p_symbols)->net_StopSend_inner
-#  define net_StopRecv (p_symbols)->net_StopRecv_inner
 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
 /******************************************************************
  * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
@@ -1105,8 +1101,6 @@ struct module_symbols_t
     ((p_symbols)->net_ListenClose_inner) = net_ListenClose; \
     ((p_symbols)->DigestMD5_inner) = DigestMD5; \
     ((p_symbols)->__net_CheckIP_inner) = __net_CheckIP; \
-    ((p_symbols)->net_StopSend_inner) = net_StopSend; \
-    ((p_symbols)->net_StopRecv_inner) = net_StopRecv; \
     (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
 
 # endif /* __PLUGIN__ */
index 528f5c970427cd43b7b451f2cb0b7ae10ad4a770..8ed0117417e8c1a5d95ced85df4d48bbc770607d 100644 (file)
@@ -1177,39 +1177,6 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
     return VLC_SUCCESS;
 }
 
-/*****************************************************************************
- * net_StopRecv/Send
- *****************************************************************************
- * Wrappers for shutdown()
- *****************************************************************************/
-int net_StopRecv( int fd )
-{
-#if defined (SHUT_RD)
-    /* the standard way */
-    return shutdown( fd, SHUT_RD );
-#elif defined (SD_RECEIVE)
-    /* the Microsoft seemingly-purposedly-different-for-the-sake-of-it way */
-    return shutdown( fd, SD_RECEIVE );
-#else
-# warning FIXME: implement shutdown on your platform!
-    return -1;
-#endif
-}
-
-int net_StopSend( int fd )
-{
-#if defined (SHUT_WR)
-    /* the standard way */
-    return shutdown( fd, SHUT_WR );
-#elif defined (SD_SEND)
-    /* the Microsoft seemingly-purposedly-different-for-the-sake-of-it way */
-    return shutdown( fd, SD_SEND );
-#else
-# warning FIXME: implement shutdown on your platform!
-    return -1;
-#endif
-}
-
 /*****************************************************************************
  * __net_CheckIP
  *****************************************************************************