X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Freturn.h;h=378194fd9fe08d33aeb1d4ffa39ba0373dd54b77;hb=60c68bea5d034012f935eb849d92781c345c7214;hp=0d3148429f46be9ad901f28c104c9ff4b6688d10;hpb=28adf7b936c6f5c25b7526ff56ec1256da1246d4;p=m6w6%2Flibmemcached diff --git a/libmemcached/return.h b/libmemcached/return.h index 0d314842..378194fd 100644 --- a/libmemcached/return.h +++ b/libmemcached/return.h @@ -84,6 +84,7 @@ enum memcached_return_t { MEMCACHED_PARSE_USER_ERROR, MEMCACHED_DEPRECATED, MEMCACHED_IN_PROGRESS, + MEMCACHED_SERVER_TEMPORARILY_DISABLED, MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ }; @@ -91,8 +92,27 @@ enum memcached_return_t { typedef enum memcached_return_t memcached_return_t; #endif +static inline bool memcached_success(memcached_return_t rc) +{ + return (rc == MEMCACHED_BUFFERED || + rc == MEMCACHED_DELETED || + rc == MEMCACHED_END || + rc == MEMCACHED_ITEM || + rc == MEMCACHED_STAT || + rc == MEMCACHED_STORED || + rc == MEMCACHED_SUCCESS || + rc == MEMCACHED_VALUE); +} -#define memcached_success(__memcached_return_t) ((__memcached_return_t) == MEMCACHED_SUCCESS or (__memcached_return_t) == MEMCACHED_END) -#define memcached_failed(__memcached_return_t) ((__memcached_return_t) != MEMCACHED_SUCCESS and (__memcached_return_t) != MEMCACHED_END) -#define memcached_continue(__memcached_return_t) ((__memcached_return_t) == MEMCACHED_IN_PROGRESS) +static inline bool memcached_failed(memcached_return_t rc) +{ + return (rc != MEMCACHED_SUCCESS && + rc != MEMCACHED_END && + rc != MEMCACHED_STORED && + rc != MEMCACHED_STAT && + rc != MEMCACHED_DELETED && + rc != MEMCACHED_BUFFERED && + rc != MEMCACHED_VALUE); +} +#define memcached_continue(__memcached_return_t) ((__memcached_return_t) == MEMCACHED_IN_PROGRESS)