X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcommon.h;h=90d8b6a8def0594cef3663b9c7d83ebe4bca8b64;hb=bb98ce33936edc0dc914652c0227f95727518b16;hp=c59981aab0f0a4a09dfccc4546ff9e6ae33241cd;hpb=04b8554c3724eae57fbd75dc6b3e69dca8b58187;p=awesomized%2Flibmemcached diff --git a/libtest/common.h b/libtest/common.h index c59981aa..90d8b6a8 100644 --- a/libtest/common.h +++ b/libtest/common.h @@ -1,9 +1,8 @@ /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * uTest * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ All - * rights reserved. + * Data Differential YATL (i.e. libtest) library + * + * Copyright (C) 2012 Data Differential, http://datadifferential.com/ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,22 +33,89 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - /* - Common include file for libmemached + Common include file for libtest */ #pragma once -#include - -#include -#include -#include - -#include #include +#include +#include #include #include +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#ifdef HAVE_SYS_TIME_H +# include +#endif + +#ifdef HAVE_SYS_WAIT_H +# include +#endif + +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif + +#ifdef HAVE_FNMATCH_H +# include +#endif + +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#if defined(WIN32) +# include "win32/wrappers.h" +# define get_socket_errno() WSAGetLastError() +#else +# 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 + +#include + +#include +#include +#include +#include + +#include +#include +#include +#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; + } +};