From: Giuseppe Scrivano Date: Fri, 7 May 2010 10:46:47 +0000 (+0200) Subject: Remove some functions not needed anymore. X-Git-Tag: v1.13~176 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=cba3187919f9a25ea763443140fa3cc2131a40ad Remove some functions not needed anymore. --- diff --git a/src/ChangeLog b/src/ChangeLog index 83baa58f..73658393 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,17 @@ * mswindows.h: Always include and . Do not include . + [! INHIBIT_WRAP]: Remove macro's socket, bind, connect, accept, recv, + send, select, getsockname, getpeername, setsockopt, closesocket. + Remove wrapped_socket, wrapped_bind, wrapped_connect, wrapped_listen, + wrapped_accept, wrapped_recv, wrapped_send, wrapped_select, + wrapped_getsockname, wrapped_getpeername, wrapped_setsockopt, + wrapped_closesocket prototypes. + + * mswindows.c: Remove wrapped_socket, wrapped_bind, wrapped_connect, + wrapped_listen, wrapped_accept, wrapped_recv, wrapped_send, + wrapped_select, wrapped_getsockname, wrapped_getpeername, + wrapped_setsockopt, wrapped_closesocket functions. Remove WRAP macro. * host.h [WINDOWS]: Include not . diff --git a/src/mswindows.c b/src/mswindows.c index f3ee0152..245cff3b 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -571,37 +571,6 @@ run_with_timeout (double seconds, void (*fun) (void *), void *arg) thread_hnd = NULL; return rc; } - -/* Wget expects network calls such as connect, recv, send, etc., to set - errno on failure. To achieve that, Winsock calls are wrapped with code - that, in case of error, sets errno to the value of WSAGetLastError(). - In addition, we provide a wrapper around strerror, which recognizes - Winsock errors and prints the appropriate error message. */ - -/* Define a macro that creates a function definition that wraps FUN into - a function that sets errno the way the rest of the code expects. */ - -#define WRAP(fun, decl, call) int wrapped_##fun decl { \ - int retval = fun call; \ - if (retval < 0) \ - errno = WSAGetLastError (); \ - return retval; \ -} - -WRAP (socket, (int domain, int type, int protocol), (domain, type, protocol)) -WRAP (bind, (int s, struct sockaddr *a, int alen), (s, a, alen)) -WRAP (connect, (int s, const struct sockaddr *a, int alen), (s, a, alen)) -WRAP (listen, (int s, int backlog), (s, backlog)) -WRAP (accept, (int s, struct sockaddr *a, int *alen), (s, a, alen)) -WRAP (recv, (int s, void *buf, int len, int flags), (s, buf, len, flags)) -WRAP (send, (int s, const void *buf, int len, int flags), (s, buf, len, flags)) -WRAP (select, (int n, fd_set *r, fd_set *w, fd_set *e, const struct timeval *tm), - (n, r, w, e, tm)) -WRAP (getsockname, (int s, struct sockaddr *n, int *nlen), (s, n, nlen)) -WRAP (getpeername, (int s, struct sockaddr *n, int *nlen), (s, n, nlen)) -WRAP (setsockopt, (int s, int level, int opt, const void *val, int len), - (s, level, opt, val, len)) -WRAP (closesocket, (int s), (s)) #ifdef ENABLE_IPV6 diff --git a/src/mswindows.h b/src/mswindows.h index bb72a282..12f55833 100644 --- a/src/mswindows.h +++ b/src/mswindows.h @@ -121,38 +121,6 @@ const char *inet_ntop (int, const void *, char *, socklen_t); # define gai_strerror strerror #endif -#ifndef INHIBIT_WRAP - -/* Winsock functions don't set errno, so we provide wrappers that do. */ - -#define socket wrapped_socket -#define bind wrapped_bind -#define connect wrapped_connect -#define listen wrapped_listen -#define accept wrapped_accept -#define recv wrapped_recv -#define send wrapped_send -#define select wrapped_select -#define getsockname wrapped_getsockname -#define getpeername wrapped_getpeername -#define setsockopt wrapped_setsockopt -#define closesocket wrapped_closesocket - -#endif /* not INHIBIT_WRAP */ - -int wrapped_socket (int, int, int); -int wrapped_bind (int, struct sockaddr *, int); -int wrapped_connect (int, const struct sockaddr *, int); -int wrapped_listen (int s, int backlog); -int wrapped_accept (int s, struct sockaddr *a, int *alen); -int wrapped_recv (int, void *, int, int); -int wrapped_send (int, const void *, int, int); -int wrapped_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *); -int wrapped_getsockname (int, struct sockaddr *, int *); -int wrapped_getpeername (int, struct sockaddr *, int *); -int wrapped_setsockopt (int, int, int, const void *, int); -int wrapped_closesocket (int); - /* Public functions. */ void ws_startup (void);