Update from build trunk.
authorBrian Aker <brian@tangent.org>
Mon, 11 Feb 2013 11:02:27 +0000 (03:02 -0800)
committerBrian Aker <brian@tangent.org>
Mon, 11 Feb 2013 11:02:27 +0000 (03:02 -0800)
16 files changed:
Makefile.am
bootstrap.sh
clients/memcapable.cc
clients/utilities.cc
configure.ac
libmemcached-1.0/platform.h
libmemcached/common.h
libmemcached/connect.cc
libmemcached/include.am
libmemcached/poll.cc
libmemcached/poll.h
libmemcached/windows.hpp [new file with mode: 0644]
libmemcachedutil-1.0/pid.h
libtest/common.h
libtest/dream.cc
libtest/lite.h

index 6aa50af828b6dec8e3734975648dc4daf68195db..a359ac00d229e52e17889078206e76b86a410afd 100644 (file)
@@ -86,6 +86,8 @@ TESTS += ${bin_PROGRAMS}
 TESTS += ${check_PROGRAMS}
 XFAIL_TESTS += ${bin_PROGRAMS}
 
+if ! BUILD_WIN32
+
 merge-clean:
        @find ./ | $(GREP) \.gcda | xargs rm -f
        @find ./ | $(GREP) \.gcno | xargs rm -f
@@ -101,8 +103,8 @@ merge-clean:
        @echo "Files that need to be either removed or checked in:"
        @bzr unknowns
 
-clean-local:
-       -rm -rf docs/_build docs/doctrees
+clean-local: clean-libtest-check clean-docs-check
+
 
 lcov: lcov-clean check
        @echo
@@ -117,11 +119,10 @@ lcov-clean: clean
        @rm -rf lcov */lcov.out
        @find . -name '*.gcno' | xargs rm -f
        @find . -name '*.gcda' | xargs rm -f
+endif
 
 DISTCLEANFILES+= config/top.h
 
-clean-local: clean-libtest-check clean-docs-check
-
 maintainer-clean-local:
        find . -type f -name '*~' -exec rm -f '{}' \;
        -rm -f @PACKAGE@-*.rpm
index fdc43f999d0024fc2b576ddf4a672631e84c8040..42c2157b4862a164f18747190400275c4b2757ff 100755 (executable)
@@ -296,42 +296,42 @@ function run_configure ()
   # Arguments for configure
   local BUILD_CONFIGURE_ARG= 
 
-  # Set ENV DEBUG in order to enable debugging
+  # If ENV DEBUG is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert
+  # Set ENV ASSERT in order to enable assert
   if $DEBUG; then 
-    BUILD_CONFIGURE_ARG='--enable-debug'
+    BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert'
+  elif [[ -n "$VCS_CHECKOUT" ]]; then
+    BUILD_CONFIGURE_ARG+=' --enable-assert'
   fi
 
-  # Set ENV ASSERT in order to enable assert
-  if [[ -n "$ASSERT" ]]; then 
-    local ASSERT_ARG=
-    ASSERT_ARG='--enable-assert'
-    BUILD_CONFIGURE_ARG="$ASSERT_ARG $BUILD_CONFIGURE_ARG"
+  if [[ -n "$CONFIGURE_ARG" ]]; then 
+    BUILD_CONFIGURE_ARG+=" $CONFIGURE_ARG"
   fi
 
-  if [[ -n "$CONFIGURE_ARG" ]]; then 
-    BUILD_CONFIGURE_ARG= "$BUILD_CONFIGURE_ARG $CONFIGURE_ARG"
+  if [[ -n "$PREFIX_ARG" ]]; then 
+    BUILD_CONFIGURE_ARG+=" $PREFIX_ARG"
   fi
 
   ret=1;
   # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
   case $HOST_OS in
     *-darwin-*)
-      CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG $PREFIX_ARG"
+      CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG"
       ret=$?
       ;;
     rhel-5*)
       command_exists 'gcc44' || die "Could not locate gcc44"
-      CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG $PREFIX_ARG"
+      CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG"
       ret=$?
       ;;
     *)
-      $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG
+      $CONFIGURE $BUILD_CONFIGURE_ARG
       ret=$?
       ;;
   esac
 
   if [ $ret -ne 0 ]; then
-    die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG"
+    die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG"
   fi
 
   if [ ! -f 'Makefile' ]; then
@@ -367,6 +367,10 @@ function save_BUILD ()
     die "OLD_CONFIGURE_ARG($OLD_CONFIGURE_ARG) was set on push, programmer error!"
   fi
 
+  if [[ -n "$OLD_PREFIX" ]]; then
+    die "OLD_PREFIX($OLD_PREFIX) was set on push, programmer error!"
+  fi
+
   if [[ -n "$OLD_MAKE" ]]; then
     die "OLD_MAKE($OLD_MAKE) was set on push, programmer error!"
   fi
@@ -402,6 +406,10 @@ function restore_BUILD ()
     CONFIGURE_ARG=$OLD_CONFIGURE_ARG
   fi
 
+  if [[ -n "$OLD_PREFIX" ]]; then
+    PREFIX_ARG=$OLD_PREFIX
+  fi
+
   if [[ -n "$OLD_MAKE" ]]; then
     MAKE=$OLD_MAKE
   fi
@@ -412,59 +420,13 @@ function restore_BUILD ()
 
   OLD_CONFIGURE=
   OLD_CONFIGURE_ARG=
+  OLD_PREFIX=
   OLD_MAKE=
   OLD_TESTS_ENVIRONMENT=
 
   export -n CC CXX
 }
 
-function push_PREFIX_ARG ()
-{
-  if [[ -n "$OLD_PREFIX_ARG" ]]; then
-    die "OLD_PREFIX_ARG was set on push, programmer error!"
-  fi
-
-  if [[ -n "$PREFIX_ARG" ]]; then
-    OLD_PREFIX_ARG=$PREFIX_ARG
-    PREFIX_ARG=
-  fi
-
-  if [[ -n "$1" ]]; then
-    PREFIX_ARG="--prefix=$1"
-  fi
-}
-
-function pop_PREFIX_ARG ()
-{
-  if [[ -n "$OLD_PREFIX_ARG" ]]; then
-    PREFIX_ARG=$OLD_PREFIX_ARG
-    OLD_PREFIX_ARG=
-  else
-    PREFIX_ARG=
-  fi
-}
-
-function push_TESTS_ENVIRONMENT ()
-{
-  if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
-    die "OLD_TESTS_ENVIRONMENT was set on push, programmer error!"
-  fi
-
-  if [[ -n "$TESTS_ENVIRONMENT" ]]; then
-    OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
-    TESTS_ENVIRONMENT=
-  fi
-}
-
-function pop_TESTS_ENVIRONMENT ()
-{
-  TESTS_ENVIRONMENT=
-  if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
-    TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
-    OLD_TESTS_ENVIRONMENT=
-  fi
-}
-
 function safe_pushd ()
 {
   pushd $1 &> /dev/null ;
@@ -513,11 +475,11 @@ function make_valgrind ()
     return 1
   fi
 
+  save_BUILD
+
   # If we are required to run configure, do so now
   run_configure_if_required
 
-  push_TESTS_ENVIRONMENT
-
   # If we don't have a configure, then most likely we will be missing libtool
   assert_file 'configure'
   if [[ -f 'libtool' ]]; then
@@ -528,13 +490,15 @@ function make_valgrind ()
 
   make_target 'check' || return 1
 
-  pop_TESTS_ENVIRONMENT
+  restore_BUILD
 }
 
 function make_install_system ()
 {
   local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX)
-  push_PREFIX_ARG $INSTALL_LOCATION
+
+  save_BUILD
+  PREFIX_ARG="--prefix=$INSTALL_LOCATION"
 
   if [ ! -d $INSTALL_LOCATION ] ; then
     die "ASSERT temp directory not found '$INSTALL_LOCATION'"
@@ -542,17 +506,12 @@ function make_install_system ()
 
   run_configure #install_buid_dir
 
-  push_TESTS_ENVIRONMENT
-
   make_target 'install'
 
   make_target 'installcheck'
 
   make_target 'uninstall'
 
-  pop_TESTS_ENVIRONMENT
-  pop_PREFIX_ARG
-
   rm -r -f $INSTALL_LOCATION
   make 'distclean'
 
@@ -560,6 +519,7 @@ function make_install_system ()
     die "ASSERT Makefile should not exist"
   fi
 
+  restore_BUILD
   safe_popd
 }
 
@@ -900,11 +860,11 @@ function make_install_html ()
 
 function make_gdb ()
 {
+  save_BUILD
+
   if command_exists 'gdb'; then
     run_configure_if_required
 
-    push_TESTS_ENVIRONMENT
-
     # Set ENV GDB_COMMAND
     if [[ -z "$GDB_COMMAND" ]]; then
       setup_gdb_command
@@ -924,8 +884,6 @@ function make_gdb ()
       rm 'gdb.txt'
     fi
 
-    pop_TESTS_ENVIRONMENT
-
     if [ -f '.gdb_history' ]; then
       rm '.gdb_history'
     fi
@@ -937,6 +895,8 @@ function make_gdb ()
     echo 'gdb was not present'
     return 1
   fi
+
+  restore_BUILD
 }
 
 # $1 target to compile
@@ -1142,6 +1102,8 @@ function determine_vcs ()
     VCS_CHECKOUT=svn
   elif [[ -d '.hg' ]]; then
     VCS_CHECKOUT=hg
+  else
+    VCS_CHECKOUT=
   fi
 
   if [[ -n "$VCS_CHECKOUT" ]]; then
@@ -1466,7 +1428,7 @@ function bootstrap ()
 
   # Set ENV PREFIX in order to set --prefix for ./configure
   if [[ -n "$PREFIX" ]]; then 
-    push_PREFIX_ARG $PREFIX
+    PREFIX_ARG="--prefix=$PREFIX"
   fi
 
   # We should always have a target by this point
@@ -1580,6 +1542,7 @@ function main ()
 
   local OLD_CONFIGURE=
   local OLD_CONFIGURE_ARG=
+  local OLD_PREFIX=
   local OLD_MAKE=
   local OLD_TESTS_ENVIRONMENT=
 
@@ -1726,11 +1689,13 @@ export AUTOHEADER
 export AUTOM4TE
 export AUTOMAKE
 export AUTORECONF
+export CONFIGURE_ARG
 export DEBUG
 export GNU_BUILD_FLAGS
 export LIBTOOLIZE
 export LIBTOOLIZE_OPTIONS
 export MAKE
+export PREFIX_ARG
 export TESTS_ENVIRONMENT
 export VERBOSE
 export WARNINGS
index c8d294f95fb14d5235aad1e43ceeb894a60f1a8e..0343e15d5d840663a0035727fdf68b4651345d6a 100644 (file)
@@ -124,7 +124,7 @@ static struct addrinfo *lookuphost(const char *hostname, const char *port)
  */
 static memcached_socket_t set_noblock(void)
 {
-#ifdef WIN32
+#if defined(_WIN32)
   u_long arg = 1;
   if (ioctlsocket(sock, FIONBIO, &arg) == SOCKET_ERROR)
   {
index 5f5958e2a193dbe8e15fe161e2a32c10067d1e38..158890515ef43840bc9d49409e386bb0706ed980 100644 (file)
@@ -184,12 +184,12 @@ void process_hash_option(memcached_st *memc, char *opt_hash)
 void initialize_sockets(void)
 {
   /* Define the function for all platforms to avoid #ifdefs in each program */
-#if defined(WIN32) && WIN32
+#if defined(_WIN32)
   WSADATA wsaData;
   if (WSAStartup(MAKEWORD(2,0), &wsaData) != 0)
   {
     fprintf(stderr, "Socket Initialization Error. Program aborted\n");
     exit(EXIT_FAILURE);
   }
-#endif
+#endif // #if defined(_WIN32)
 }
index 9923d88809186c3e1ad3e9f8f2a86874f6567d7a..8808ad266fb19cf35cd9fb02ee9f2c56d162ac43 100644 (file)
@@ -1,5 +1,5 @@
 # LibmemcacheD
-# Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+# Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/
 # Copyright (C) 2006-2010 Brian Aker, Monty Taylor, Trond Norbye
 # All rights reserved.
 #
@@ -287,10 +287,12 @@ AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
          ])
 CHECK_FOR_PTHREAD_AND_SASL
 
-
 # backtrace(), others require shared builds
-AS_IF([test "x$enable_shared" = "xyes"],
-      [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])
+AC_DEFUN([__ENABLE_SHARED],
+         [AC_REQUIRE([AX_PLATFORM])
+         AS_IF([test "x${TARGET_WINDOWS}" = "xtrue"],[enable_shared=no])
+         AS_IF([test "x$enable_shared" = "xyes"],
+               [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])])
 AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"])
 
 PANDORA_ENABLE_DTRACE
index 9cbc705fcd30ac9e9f77d55f70e264854c9e94b6..efdf53f81b495dd2ea2ad3f5bac8cbd9b554b6c8 100644 (file)
@@ -38,7 +38,7 @@
 #pragma once
 
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 # include <winsock2.h>
 # include <ws2tcpip.h>
 
@@ -59,4 +59,4 @@ typedef SOCKET memcached_socket_t;
 
 typedef int memcached_socket_t;
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
index fac6d7758de58794a16f4c38ca91c9b567ccf211..71db19b01bd85b2d59faa99ec9ad39c0c086ec89 100644 (file)
 # include <dlfcn.h>
 #endif
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 # include "libmemcached/windows.hpp"
 #endif
 
index 2ec9975c319d5ba23f260c15b3ca4a5121441ea8..22e259f41f3335fdfb75dcd23a040bfef4d00cb5 100644 (file)
@@ -267,7 +267,7 @@ static memcached_return_t set_hostinfo(org::libmemcached::Instance* server)
 
 static inline void set_socket_nonblocking(org::libmemcached::Instance* server)
 {
-#ifdef WIN32
+#if defined(_WIN32)
   u_long arg= 1;
   if (ioctlsocket(server->fd, FIONBIO, &arg) == SOCKET_ERROR)
   {
@@ -372,7 +372,7 @@ static bool set_socket_options(org::libmemcached::Instance* server)
 
 #if defined(_WIN32)
 #else
-#if defined(SO_NOSIGPIPE)
+# if defined(SO_NOSIGPIPE)
   if (SO_NOSIGPIPE)
   {
     int set= 1;
@@ -388,7 +388,7 @@ static bool set_socket_options(org::libmemcached::Instance* server)
 #endif
     }
   }
-#endif // SO_NOSIGPIPE
+# endif // SO_NOSIGPIPE
 #endif // _WIN32
 
   if (server->root->flags.no_block)
@@ -461,7 +461,7 @@ static bool set_socket_options(org::libmemcached::Instance* server)
 
 static memcached_return_t unix_socket_connect(org::libmemcached::Instance* server)
 {
-#ifndef WIN32
+#ifndef _WIN32
   WATCHPOINT_ASSERT(server->fd == INVALID_SOCKET);
 
   do {
index f604731ae030c5c2705db849aff789b5d2b3e20c..0aabc2487c6f254f49ad5f70c24076fb7d7bb030 100644 (file)
@@ -50,6 +50,7 @@ noinst_HEADERS+= libmemcached/udp.hpp
 noinst_HEADERS+= libmemcached/version.hpp 
 noinst_HEADERS+= libmemcached/virtual_bucket.h 
 noinst_HEADERS+= libmemcached/watchpoint.h
+noinst_HEADERS+= libmemcached/windows.hpp
 
 lib_LTLIBRARIES+= libmemcached/libmemcached.la
 EXTRA_libmemcached_libmemcached_la_DEPENDENCIES=
@@ -61,8 +62,8 @@ libmemcached_libmemcached_la_CXXFLAGS= -DBUILDING_LIBMEMCACHED
 if BUILD_WIN32
 libmemcached_libmemcached_la_CFLAGS+= -DBUILDING_HASHKIT
 libmemcached_libmemcached_la_CXXFLAGS+= -DBUILDING_HASHKIT
-libmemcached_libmemcached_la_LIBADD+= -lmingw64
-libmemcached_libmemcached_la_LIBADD+= -lws2_64
+libmemcached_libmemcached_la_LIBADD+= -lmingw32
+libmemcached_libmemcached_la_LIBADD+= -lws2_32
 endif
 
 libmemcached_libmemcached_la_SOURCES+= libmemcached/instance.cc
index abd15d4cb770886f9f114b40078941e77b84b6cb..6fdf242c90d0637c2eba38df2d9c3f2cb716fe28 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "libmemcached/common.h"
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 #include "libmemcached/poll.h"
 
 #include <sys/time.h>
@@ -31,7 +31,7 @@ int poll(struct pollfd fds[], nfds_t nfds, int tmo)
   {
     if (fds[x].events & (POLLIN | POLLOUT))
     {
-#ifndef WIN32
+#ifndef _WIN32
       if (fds[x].fd > maxfd)
       {
         maxfd= fds[x].fd;
@@ -82,4 +82,4 @@ int poll(struct pollfd fds[], nfds_t nfds, int tmo)
    return ret;
 }
 
-#endif // defined(WIN32) || defined(__MINGW32__)
+#endif // defined(_WIN32)
index 8445f009421987043c586db45730798a0aae66b9..46636c402e1d32b12d22a8f7abe2c94db59f54c9 100644 (file)
@@ -12,7 +12,7 @@
 
 #pragma once
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 
 #include <winsock2.h>
 
@@ -22,7 +22,7 @@ extern "C" {
 
 typedef struct pollfd
 {
-#ifdef WIN32
+#if defined(_WIN32)
   SOCKET fd;
 #else
   int fd;
@@ -45,4 +45,4 @@ int poll(struct pollfd fds[], nfds_t nfds, int tmo);
 }
 #endif
 
-#endif // defined(WIN32) || defined(__MINGW32__)
+#endif // defined(_WIN32)
diff --git a/libmemcached/windows.hpp b/libmemcached/windows.hpp
new file mode 100644 (file)
index 0000000..40564b1
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Libmemcached library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+# include <cerrno>
+#else
+# include <errno.h>
+#endif
+
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+
+#ifdef __MINGW32__
+# if(_WIN32_WINNT >= 0x0501)
+# else
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT 0x0501
+# endif /* _WIN32_WINNT >= 0x0501 */
+#endif /* __MINGW32__ */
+
+#if defined(HAVE_WINSOCK2_H) && HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
+
+#if defined(HAVE_WS2TCPIP_H) && HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
+
+#if defined(HAVE_IO_H) && HAVE_IO_H
+# include <io.h>
+#endif
+
+struct sockaddr_un
+{
+  short int sun_family;
+  char sun_path[108];
+};
+
+static inline int translate_windows_error()
+{
+  int local_errno= WSAGetLastError();
+
+  switch(local_errno) {
+  case WSAEINVAL:
+    local_errno= EINPROGRESS;
+    break;
+  case WSAEALREADY:
+  case WSAEWOULDBLOCK:
+    local_errno= EAGAIN;
+    break;
+
+  case WSAECONNREFUSED:
+    local_errno= ECONNREFUSED;
+    break;
+
+  case WSAENETUNREACH:
+    local_errno= ENETUNREACH;
+    break;
+
+  case WSAETIMEDOUT:
+    local_errno= ETIMEDOUT;
+    break;
+
+  case WSAECONNRESET:
+    local_errno= ECONNRESET;
+    break;
+
+  case WSAEADDRINUSE:
+    local_errno= EADDRINUSE;
+    break;
+
+  case WSAEOPNOTSUPP:
+    local_errno= EOPNOTSUPP;
+    break;
+
+  case WSAENOPROTOOPT:
+    local_errno= ENOPROTOOPT;
+    break;
+
+  default:
+    break;
+  }
+
+  return local_errno;
+}
index 01738accf3ede3efef13c50aada6712a6d988436..3ce0131c1f78f18dbe1521b6a0031fb20e896081 100644 (file)
@@ -36,8 +36,8 @@
 
 #pragma once
 
-#ifndef WIN32
-#include <netdb.h>
+#ifndef _WIN32
+# include <netdb.h>
 #endif
 
 #include <sys/types.h>
index 7be0221c343b57bb919a8011a0497c990cc171c4..b611e1a9fcd18a7cae461a8e5b85162e767a465e 100644 (file)
@@ -69,7 +69,7 @@
 # include <arpa/inet.h>
 #endif
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 # include "win32/wrappers.h"
 # define get_socket_errno() WSAGetLastError()
 #else
index 114ac672515af7b7d99ff3629574f8096f0fdf5d..cd7d6aa67e11e104567d8aacb0a44d53a2da4e83 100644 (file)
@@ -41,7 +41,7 @@ namespace libtest {
 
 void dream(time_t tv_sec, long tv_nsec)
 {
-#ifdef WIN32
+#if defined(_WIN32)
   if (tv_sec == 0 and tv_nsec)
   {
     tv_sec++;
index 52e96380ca60ac873f53e63287ab4058b8db8432..100b8e2044cc34856b986d68ce642fdf35d88d18 100644 (file)
@@ -51,7 +51,7 @@
 # include <string.h>
 #endif
 
-#ifdef _WIN32
+#if defined(_WIN32)
 # include <malloc.h>
 #else
 # include <alloca.h>