From ea47169abd0793bb7eb1b72e4de411ae9b43dce4 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 12 Feb 2010 11:23:18 -0800 Subject: [PATCH] Modifying inline's --- ChangeLog | 3 +++ libmemcached/result.c | 42 ++++++++++++++++++++++++++++++ libmemcached/result.h | 60 +++++++++++++++---------------------------- libmemcached/server.c | 12 +++++++++ libmemcached/server.h | 16 ++++-------- libmemcached/string.c | 19 ++++++++++++++ libmemcached/string.h | 24 ++++++----------- 7 files changed, 110 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b946b43..32427630 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +0.39 +* Modify inline calls for compatibility. + 0.38 Wed Feb 10 09:40:33 PST 2010 * C++ interface for libhashkit. * Modified memcached_set_memory_allocators() so that it requires a context pointer. diff --git a/libmemcached/result.c b/libmemcached/result.c index 037293e7..06e3ba9e 100644 --- a/libmemcached/result.c +++ b/libmemcached/result.c @@ -94,3 +94,45 @@ memcached_return_t memcached_result_set_value(memcached_result_st *ptr, { return memcached_string_append(&ptr->value, value, length); } + +inline const char *memcached_result_key_value(const memcached_result_st *self) +{ + return self->key_length ? self->item_key : NULL; +} + +inline size_t memcached_result_key_length(const memcached_result_st *self) +{ + return self->key_length; +} + +inline const char *memcached_result_value(const memcached_result_st *self) +{ + const memcached_string_st *sptr= &self->value; + return memcached_string_value(sptr); +} + +inline size_t memcached_result_length(const memcached_result_st *self) +{ + const memcached_string_st *sptr= &self->value; + return memcached_string_length(sptr); +} + +inline uint32_t memcached_result_flags(const memcached_result_st *self) +{ + return self->item_flags; +} + +inline uint64_t memcached_result_cas(const memcached_result_st *self) +{ + return self->item_cas; +} + +inline void memcached_result_set_flags(memcached_result_st *self, uint32_t flags) +{ + self->item_flags= flags; +} + +inline void memcached_result_set_expiration(memcached_result_st *self, time_t expiration) +{ + self->item_expiration= expiration; +} diff --git a/libmemcached/result.h b/libmemcached/result.h index a7fe00b4..59ce9b91 100644 --- a/libmemcached/result.h +++ b/libmemcached/result.h @@ -42,50 +42,32 @@ LIBMEMCACHED_API memcached_result_st *memcached_result_create(const memcached_st *ptr, memcached_result_st *result); -static inline const char *memcached_result_key_value(const memcached_result_st *self) -{ - return self->key_length ? self->item_key : NULL; -} - -static inline size_t memcached_result_key_length(const memcached_result_st *self) -{ - return self->key_length; -} - -static inline const char *memcached_result_value(const memcached_result_st *self) -{ - const memcached_string_st *sptr= &self->value; - return memcached_string_value(sptr); -} - -static inline size_t memcached_result_length(const memcached_result_st *self) -{ - const memcached_string_st *sptr= &self->value; - return memcached_string_length(sptr); -} - -static inline uint32_t memcached_result_flags(const memcached_result_st *self) -{ - return self->item_flags; -} - -static inline uint64_t memcached_result_cas(const memcached_result_st *self) -{ - return self->item_cas; -} +LIBMEMCACHED_API +const char *memcached_result_key_value(const memcached_result_st *self); + +LIBMEMCACHED_API +size_t memcached_result_key_length(const memcached_result_st *self); + +LIBMEMCACHED_API +const char *memcached_result_value(const memcached_result_st *self); + +LIBMEMCACHED_API +size_t memcached_result_length(const memcached_result_st *self); + +LIBMEMCACHED_API +uint32_t memcached_result_flags(const memcached_result_st *self); + +LIBMEMCACHED_API +uint64_t memcached_result_cas(const memcached_result_st *self); LIBMEMCACHED_API memcached_return_t memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length); -static inline void memcached_result_set_flags(memcached_result_st *self, uint32_t flags) -{ - self->item_flags= flags; -} +LIBMEMCACHED_API +void memcached_result_set_flags(memcached_result_st *self, uint32_t flags); -static inline void memcached_result_set_expiration(memcached_result_st *self, time_t expiration) -{ - self->item_expiration= expiration; -} +LIBMEMCACHED_API +void memcached_result_set_expiration(memcached_result_st *self, time_t expiration); #ifdef __cplusplus } // extern "C" diff --git a/libmemcached/server.c b/libmemcached/server.c index f480750d..e7c54b98 100644 --- a/libmemcached/server.c +++ b/libmemcached/server.c @@ -263,3 +263,15 @@ memcached_return_t memcached_server_remove(memcached_server_st *st_ptr) return MEMCACHED_SUCCESS; } + + +inline uint32_t memcached_servers_count(memcached_server_st *servers) +{ + return servers->number_of_hosts; +} + + +inline uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count) +{ + return servers->number_of_hosts= count; +} diff --git a/libmemcached/server.h b/libmemcached/server.h index 51747528..9e468038 100644 --- a/libmemcached/server.h +++ b/libmemcached/server.h @@ -145,17 +145,11 @@ memcached_server_st *memcached_server_list_append_with_weight(memcached_server_s LIBMEMCACHED_API unsigned int memcached_server_list_count(memcached_server_st *ptr); -// Local Only Inline -static inline uint32_t memcached_servers_count(memcached_server_st *servers) -{ - return servers->number_of_hosts; -} - -// Local Only Inline -static inline uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count) -{ - return servers->number_of_hosts= count; -} +LIBMEMCACHED_API +uint32_t memcached_servers_count(memcached_server_st *servers); + +LIBMEMCACHED_LOCAL +uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count); #define memcached_server_count(A) (A)->number_of_hosts diff --git a/libmemcached/string.c b/libmemcached/string.c index 464d55c0..3a6ee9ac 100644 --- a/libmemcached/string.c +++ b/libmemcached/string.c @@ -177,3 +177,22 @@ memcached_return_t memcached_string_check(memcached_string_st *string, size_t ne return _string_check(string, need); } +inline size_t memcached_string_length(const memcached_string_st *self) +{ + return (size_t)(self->end - self->string); +} + +inline size_t memcached_string_size(const memcached_string_st *self) +{ + return self->current_size; +} + +inline const char *memcached_string_value(const memcached_string_st *self) +{ + return self->string; +} + +inline char *memcached_string_value_mutable(const memcached_string_st *self) +{ + return self->string; +} diff --git a/libmemcached/string.h b/libmemcached/string.h index 605ac57b..d517a4b6 100644 --- a/libmemcached/string.h +++ b/libmemcached/string.h @@ -59,25 +59,17 @@ memcached_return_t memcached_string_reset(memcached_string_st *string); LIBMEMCACHED_LOCAL void memcached_string_free(memcached_string_st *string); -static inline size_t memcached_string_length(const memcached_string_st *self) -{ - return (size_t)(self->end - self->string); -} +LIBMEMCACHED_LOCAL +size_t memcached_string_length(const memcached_string_st *self); -static inline size_t memcached_string_size(const memcached_string_st *self) -{ - return self->current_size; -} +LIBMEMCACHED_LOCAL +size_t memcached_string_size(const memcached_string_st *self); -static inline const char *memcached_string_value(const memcached_string_st *self) -{ - return self->string; -} +LIBMEMCACHED_LOCAL +const char *memcached_string_value(const memcached_string_st *self); -static inline char *memcached_string_value_mutable(const memcached_string_st *self) -{ - return self->string; -} +LIBMEMCACHED_LOCAL +char *memcached_string_value_mutable(const memcached_string_st *self); #define memcached_string_set_length(A, B) (A)->end= (A)->string + B -- 2.30.2