From: Date: Sun, 20 Jan 2008 01:23:41 +0000 (-0500) Subject: Working on getting version patch working X-Git-Tag: 0.14~10 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=c2d28746eb6de14c93c31d68288f3d33a8f4eee2;p=m6w6%2Flibmemcached Working on getting version patch working --- diff --git a/docs/Makefile.am b/docs/Makefile.am index 0234e833..6eaf8eeb 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -22,6 +22,7 @@ EXTRA_DIST = libmemcached.pod\ memcp.pod\ memcached_delete.pod\ memcached_set.pod\ + memcached_version.pod\ memflush.pod man_MANS = libmemcached.3\ @@ -77,7 +78,9 @@ man_MANS = libmemcached.3\ memcached_stat_servername.3\ memcached_strerror.3\ memcached_quit.3\ - memcached_verbosity.3 + memcached_verbosity.3\ + memcached_lib_version.3\ + memcached_version.3 libmemcached.3: libmemcached.pod pod2man -c "libmemcached" -r "" -s 3 libmemcached.pod > libmemcached.3 @@ -253,6 +256,12 @@ memcached_result_flags.3: memcached_result_st.pod memcached_result_cas.3: memcached_result_st.pod pod2man -c "libmemcached" -r "" -s 3 memcached_result_st.pod > memcached_result_cas.3 +memcached_version.3: memcached_version.pod + pod2man -c "libmemcached" -r "" -s 3 memcached_version.pod > memcached_version.3 + +memcached_lib_version.3: memcached_version.pod + pod2man -c "libmemcached" -r "" -s 3 memcached_version.pod > memcached_lib_version.3 + memcp.1: memcp.pod pod2man -c "libmemcached" -r "" -s 1 memcp.pod > memcp.1 @@ -274,6 +283,7 @@ memerror.1: memerror.pod memflush.1: memflush.pod pod2man -c "libmemcached" -r "" -s 1 memflush.pod > memflush.1 + clean: rm -f *.1 rm -f *.3 diff --git a/docs/libmemcached.pod b/docs/libmemcached.pod index c40072f6..6c98bc32 100755 --- a/docs/libmemcached.pod +++ b/docs/libmemcached.pod @@ -81,6 +81,23 @@ This is the "stride" used in the consistent hash used between replicas. Maximum allowed size of the hostname. +=item MEMCACHED_VERSION_STRING + +String value of libmemcached version such as "1.23.4" + +=item MEMCACHED_MAJOR_VERSION + +Major version value. Such as 1.23.4, would be 1 + +=item MEMCACHED_MINOR_VERSION + +Major version value. Such as 1.23.4, would be 23 + +=item MEMCACHED_MICRO_VERSION + +Major version value. Such as 1.23.4, would be 4 + + =back diff --git a/include/memcached.h b/include/memcached.h index 05cb74a8..1f1479c9 100644 --- a/include/memcached.h +++ b/include/memcached.h @@ -31,6 +31,13 @@ extern "C" { #define MEMCACHED_STRIDE 4 #define MEMCACHED_DEFAULT_TIMEOUT INT32_MAX +/* string value */ +#define MEMCACHED_VERSION_STRING "0.14" +/* binary values */ +#define MEMCACHED_MAJOR_VERSION 0 +#define MEMCACHED_MAJOR_VERSION 14 +#define MEMCACHED_MICRO_VERSION 0 + typedef enum { MEMCACHED_SUCCESS, MEMCACHED_FAILURE, @@ -220,6 +227,8 @@ struct memcached_st { }; /* Public API */ +const char * memcached_lib_version(void); + memcached_st *memcached_create(memcached_st *ptr); void memcached_free(memcached_st *ptr); memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr); diff --git a/lib/memcached_version.c b/lib/memcached_version.c index 2863b76b..f4a04d7d 100644 --- a/lib/memcached_version.c +++ b/lib/memcached_version.c @@ -1,5 +1,9 @@ #include "common.h" +const char * memcached_lib_version(void) { + return LIBMEMCACHED_VERSION_STRING; +} + memcached_return memcached_version(memcached_st *ptr) { unsigned int x; diff --git a/tests/function.c b/tests/function.c index 6ca61d7d..748eac57 100644 --- a/tests/function.c +++ b/tests/function.c @@ -889,6 +889,14 @@ uint8_t get_stats_keys(memcached_st *memc) return 0; } +uint8_t version_string_test +{ + const char *version_string; + version_string= memcached_lib_version(); + assert(!strcmp(version_string, MEMCACHE_VERSION_STRING)); + return 0; +} + uint8_t get_stats(memcached_st *memc) { unsigned int x; @@ -2134,6 +2142,7 @@ test_st tests[] ={ {"get_stats_keys", 0, get_stats_keys }, {"behavior_test", 0, get_stats_keys }, {"callback_test", 0, get_stats_keys }, + {"version_string_test", 0, version_string_test}, {0, 0, 0} };