summaryrefslogtreecommitdiff
path: root/librabbitmq/windows
diff options
context:
space:
mode:
authorMichael Steinert <mike.steinert@gmail.com>2012-05-16 12:13:31 -0600
committerMichael Steinert <mike.steinert@gmail.com>2012-05-17 11:44:46 -0600
commitc921feb829e79a33938300350e61e3c3fb217968 (patch)
treeb2054ac86a99fc4a52ded75826aad86e2561781b /librabbitmq/windows
parent162fc19f4d896c3db862f1da303823dcbe9780ec (diff)
downloadrabbitmq-c-github-ask-c921feb829e79a33938300350e61e3c3fb217968.tar.gz
Set default visibility to hidden & enable a couple more warnings
Enable the following GCC options: 1. -Wstrict-prototypes 2. -Wcast-align 3. -fno-common 4. -fvisibility=hidden This commit also includes some general cleanup of header files (mostly for readability). Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
Diffstat (limited to 'librabbitmq/windows')
-rw-r--r--librabbitmq/windows/socket.c33
-rw-r--r--librabbitmq/windows/socket.h39
2 files changed, 42 insertions, 30 deletions
diff --git a/librabbitmq/windows/socket.c b/librabbitmq/windows/socket.c
index 72ad200..43b919b 100644
--- a/librabbitmq/windows/socket.c
+++ b/librabbitmq/windows/socket.c
@@ -37,13 +37,11 @@
#include "config.h"
#endif
-#include <windows.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "amqp.h"
#include "amqp_private.h"
#include "socket.h"
+#include <stdint.h>
+#include <stdlib.h>
+#include <windows.h>
static int called_wsastartup;
@@ -76,3 +74,28 @@ char *amqp_os_error_string(int err)
LocalFree(msg);
return copy;
}
+
+int
+amqp_socket_setsockopt(int sock, int level, int optname,
+ const void *optval, size_t optlen)
+{
+ /* the winsock setsockopt function has its 4th argument as a
+ const char * */
+ return setsockopt(sock, level, optname, (const char *)optval, optlen);
+}
+
+int
+amqp_socket_writev(int sock, struct iovec *iov, int nvecs)
+{
+ DWORD ret;
+ if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0)
+ return ret;
+ else
+ return -1;
+}
+
+int
+amqp_socket_error(void)
+{
+ return WSAGetLastError() | ERROR_CATEGORY_OS;
+}
diff --git a/librabbitmq/windows/socket.h b/librabbitmq/windows/socket.h
index 0665b3a..4572410 100644
--- a/librabbitmq/windows/socket.h
+++ b/librabbitmq/windows/socket.h
@@ -35,37 +35,26 @@
#include <winsock2.h>
-extern int amqp_socket_init(void);
-
-#define amqp_socket_socket socket
-#define amqp_socket_close closesocket
-
-static inline int amqp_socket_setsockopt(int sock, int level, int optname,
- const void *optval, size_t optlen)
-{
- /* the winsock setsockopt function has its 4th argument as a
- const char * */
- return setsockopt(sock, level, optname, (const char *)optval, optlen);
-}
-
/* same as WSABUF */
struct iovec {
u_long iov_len;
void *iov_base;
};
-static inline int amqp_socket_writev(int sock, struct iovec *iov, int nvecs)
-{
- DWORD ret;
- if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0)
- return ret;
- else
- return -1;
-}
+int
+amqp_socket_init(void);
+
+#define amqp_socket_socket socket
+#define amqp_socket_close closesocket
+
+int
+amqp_socket_setsockopt(int sock, int level, int optname, const void *optval,
+ size_t optlen);
+
+int
+amqp_socket_writev(int sock, struct iovec *iov, int nvecs);
-static inline int amqp_socket_error()
-{
- return WSAGetLastError() | ERROR_CATEGORY_OS;
-}
+int
+amqp_socket_error(void);
#endif