X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcommon.h;h=90d8b6a8def0594cef3663b9c7d83ebe4bca8b64;hb=1be11f8bb8fdf368985d9e1c900b250541dc4791;hp=20b482586402820dcf041e7e78665eb6a00575c1;hpb=fa5dde3af5a99cda67d0ab005393cfd1627bd3d5;p=awesomized%2Flibmemcached diff --git a/libtest/common.h b/libtest/common.h index 20b48258..90d8b6a8 100644 --- a/libtest/common.h +++ b/libtest/common.h @@ -46,45 +46,40 @@ #include #ifdef HAVE_SYS_TYPES_H -#include +# include #endif #ifdef HAVE_SYS_TIME_H -#include +# include #endif #ifdef HAVE_SYS_WAIT_H -#include +# include #endif #ifdef HAVE_SYS_RESOURCE_H -#include +# include #endif #ifdef HAVE_FNMATCH_H -#include -#endif - -#ifdef HAVE_NETDB_H -# include -#endif - -#ifdef HAVE_NETINET_IN_H -# include +# include #endif #ifdef HAVE_ARPA_INET_H # include #endif -#ifdef HAVE_POLL_H -# include +#if defined(WIN32) +# include "win32/wrappers.h" +# define get_socket_errno() WSAGetLastError() #else -# include "poll/poll.h" -#endif - -#ifdef HAVE_SPAWN_H -# include +# ifdef HAVE_UNISTD_H +# include +# endif +# define INVALID_SOCKET -1 +# define SOCKET_ERROR -1 +# define closesocket(a) close(a) +# define get_socket_errno() errno #endif #include @@ -102,3 +97,25 @@ #include #include +struct FreeFromVector +{ + template + void operator() ( T* ptr) const + { + if (ptr) + { + free(ptr); + ptr= NULL; + } + } +}; + +struct DeleteFromVector +{ + template + void operator() ( T* ptr) const + { + delete ptr; + ptr= NULL; + } +};