semver: 1.0 -> 1
[m6w6/libmemcached] / include / libmemcached-1 / return.h
1 /*
2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
14 */
15
16 #pragma once
17
18 static inline bool memcached_success(memcached_return_t rc) {
19 return (rc == MEMCACHED_BUFFERED || rc == MEMCACHED_DELETED || rc == MEMCACHED_END
20 || rc == MEMCACHED_ITEM || rc == MEMCACHED_STAT || rc == MEMCACHED_STORED
21 || rc == MEMCACHED_SUCCESS || rc == MEMCACHED_VALUE);
22 }
23
24 static inline bool memcached_failed(memcached_return_t rc) {
25 return (rc != MEMCACHED_AUTH_CONTINUE && rc != MEMCACHED_BUFFERED && rc != MEMCACHED_DELETED
26 && rc != MEMCACHED_END && rc != MEMCACHED_ITEM && rc != MEMCACHED_STAT
27 && rc != MEMCACHED_STORED && rc != MEMCACHED_SUCCESS && rc != MEMCACHED_VALUE);
28 }
29
30 static inline bool memcached_fatal(memcached_return_t rc) {
31 return (rc != MEMCACHED_AUTH_CONTINUE && rc != MEMCACHED_BUFFERED && rc != MEMCACHED_CLIENT_ERROR
32 && rc != MEMCACHED_DATA_EXISTS && rc != MEMCACHED_DELETED && rc != MEMCACHED_E2BIG
33 && rc != MEMCACHED_END && rc != MEMCACHED_ITEM && rc != MEMCACHED_ERROR
34 && rc != MEMCACHED_NOTFOUND && rc != MEMCACHED_NOTSTORED
35 && rc != MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE && rc != MEMCACHED_STAT
36 && rc != MEMCACHED_STORED && rc != MEMCACHED_SUCCESS && rc != MEMCACHED_VALUE);
37 }
38
39 #define memcached_continue(__memcached_return_t) ((__memcached_return_t) == MEMCACHED_IN_PROGRESS)