X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Flibmemcached%2Fcommon.h;h=ed12d617fad5d74424b9caceaa21b6e19d5e1d8a;hb=92d18858b417309f6bdee6bce464a4f3d6a375fd;hp=eea5319b654c800dcecd20cbe867b67d65ae3db0;hpb=aeac01630eed825d8a624e7fd7c107d47bb2e40c;p=awesomized%2Flibmemcached diff --git a/src/libmemcached/common.h b/src/libmemcached/common.h index eea5319b..ed12d617 100644 --- a/src/libmemcached/common.h +++ b/src/libmemcached/common.h @@ -1,6 +1,6 @@ /* +--------------------------------------------------------------------+ - | libmemcached - C/C++ Client Library for memcached | + | libmemcached-awesome - C/C++ Client Library for memcached | +--------------------------------------------------------------------+ | Redistribution and use in source and binary forms, with or without | | modification, are permitted under the terms of the BSD license. | @@ -9,7 +9,7 @@ | the terms online at: https://opensource.org/licenses/BSD-3-Clause | +--------------------------------------------------------------------+ | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ | - | Copyright (c) 2020 Michael Wallner | + | Copyright (c) 2020-2021 Michael Wallner https://awesome.co/ | +--------------------------------------------------------------------+ */ @@ -38,24 +38,13 @@ # include #endif -#ifdef HAVE_SYS_UN_H -# include -#endif +#include "p9y/socket.hpp" #ifdef HAVE_SYS_TIME_H # include #endif #include -#include - -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifdef HAVE_SYS_SOCKET_H -# include -#endif #ifdef HAVE_STRINGS_H # include @@ -65,17 +54,11 @@ # include #endif -#if defined(_WIN32) -# include "libmemcached/windows.hpp" -#endif - #include "libmemcached-1.0/memcached.h" #include "libmemcached/watchpoint.h" #include "libmemcached/is.h" typedef struct memcached_st Memcached; -#include "libmemcached/poll.h" - #ifdef __cplusplus memcached_instance_st *memcached_instance_fetch(memcached_st *ptr, uint32_t server_key); #endif @@ -90,7 +73,6 @@ memcached_instance_st *memcached_instance_fetch(memcached_st *ptr, uint32_t serv # include "libmemcached/io.hpp" # include "libmemcached/udp.hpp" # include "libmemcached/do.hpp" -# include "libmemcached/socket.hpp" # include "libmemcached/connect.hpp" # include "libmemcached/allocators.hpp" # include "libmemcached/hash.hpp" @@ -151,17 +133,28 @@ extern "C" { memcached_return_t run_distribution(memcached_st *ptr); #ifdef __cplusplus +# include "p9y/poll.hpp" static inline void memcached_server_response_increment(memcached_instance_st *instance) { instance->events(POLLIN); instance->cursor_active_++; } #endif -#define memcached_server_response_decrement(A) (A)->cursor_active_-- -#define memcached_server_response_reset(A) (A)->cursor_active_ = 0 +#define memcached_server_response_decrement(A) do { \ + WATCHPOINT_ASSERT((A)->cursor_active_ > 0); \ + if ((A)->cursor_active_ > 0) { \ + (A)->cursor_active_--; \ + } \ +} while (0) +#define memcached_server_response_reset(A) (A)->cursor_active_ = 0 #define memcached_instance_response_increment(A) (A)->cursor_active_++ -#define memcached_instance_response_decrement(A) (A)->cursor_active_-- +#define memcached_instance_response_decrement(A) do { \ + WATCHPOINT_ASSERT((A)->cursor_active_ > 0); \ + if ((A)->cursor_active_ > 0) { \ + (A)->cursor_active_--; \ + } \ +} while (0) #define memcached_instance_response_reset(A) (A)->cursor_active_ = 0 #ifdef __cplusplus