X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libhashkit%2Ftypes.h;h=e0f1f1387ffc2097723c58e1a438ca4e61ad68b6;hb=000909672d7d6337c2115a9f263d22e39a28917c;hp=23bd9d5c4f22d2a8b992dbd012ba2ff9a6bc7ba5;hpb=c4dbc7e56b01545e25bc95ba122c79d4a2631a99;p=awesomized%2Flibmemcached diff --git a/libhashkit/types.h b/libhashkit/types.h index 23bd9d5c..e0f1f138 100644 --- a/libhashkit/types.h +++ b/libhashkit/types.h @@ -36,13 +36,7 @@ */ -#ifndef HASHKIT_TYPES_H -#define HASHKIT_TYPES_H - -#ifdef __cplusplus - -extern "C" { -#endif +#pragma once typedef enum { HASHKIT_SUCCESS, @@ -53,6 +47,16 @@ typedef enum { HASHKIT_MAXIMUM_RETURN /* Always add new error code before */ } hashkit_return_t; +static inline bool hashkit_success(const hashkit_return_t rc) +{ + return (rc == HASHKIT_SUCCESS); +} + +static inline bool hashkit_failed(const hashkit_return_t rc) +{ + return (rc != HASHKIT_SUCCESS); +} + typedef enum { HASHKIT_HASH_DEFAULT= 0, // hashkit_one_at_a_time() HASHKIT_HASH_MD5, @@ -79,6 +83,9 @@ typedef enum HASHKIT_DISTRIBUTION_MAX /* Always add new values before this. */ } hashkit_distribution_t; +#ifdef __cplusplus +extern "C" { +#endif typedef struct hashkit_st hashkit_st; @@ -87,5 +94,3 @@ typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length, void *co #ifdef __cplusplus } #endif - -#endif /* HASHKIT_TYPES_H */