X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=libtest%2Fcommon.h;h=b611e1a9fcd18a7cae461a8e5b85162e767a465e;hb=d9db3f534bc38ea22e83e5529ff93aea4150ab19;hp=6c7e294c576aac4f99c3e63e45198dc81bcf94b1;hpb=23dca174eef8d846e3d4402729b57f6ded035e64;p=m6w6%2Flibmemcached diff --git a/libtest/common.h b/libtest/common.h index 6c7e294c..b611e1a9 100644 --- a/libtest/common.h +++ b/libtest/common.h @@ -69,7 +69,7 @@ # include #endif -#if defined(WIN32) || defined(__MINGW32__) +#if defined(_WIN32) # include "win32/wrappers.h" # define get_socket_errno() WSAGetLastError() #else @@ -97,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; + } +};