From: Date: Sat, 19 Jan 2008 23:09:02 +0000 (-0500) Subject: Pulling back the C++ code to just be an include. X-Git-Tag: 0.14~6^2~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b48e92d90526de44439d2d562ceea11f15ef6f30;p=awesomized%2Flibmemcached Pulling back the C++ code to just be an include. --- diff --git a/include/memcached.hh b/include/memcached.hh index a359488d..a27971c1 100644 --- a/include/memcached.hh +++ b/include/memcached.hh @@ -3,6 +3,7 @@ #endif #include +#include #include class Memcached @@ -11,13 +12,35 @@ class Memcached public: - Memcached(); - Memcached(memcached_st *clone); + Memcached() + { + memcached_create(&memc); + } + + Memcached(memcached_st *clone) + { + WATCHPOINT; + memcached_clone(&memc, clone); + WATCHPOINT; + } + + char *get(char *key, size_t *value_length) + { + uint32_t flags; + memcached_return rc; + + return memcached_get(&memc, key, strlen(key), + value_length, &flags, &rc); + } + + memcached_return set(char *key, char *value, size_t value_length) + { + return memcached_set(&memc, key, strlen(key), + value, value_length, + (time_t)0, (uint32_t)0); + } ~Memcached() { memcached_free(&memc); } - - char *get(char *key, size_t *value_length); - memcached_return set(char *key, char *value, size_t value_length); }; diff --git a/lib/Makefile.am b/lib/Makefile.am index 707da9bb..5589e3b9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -24,7 +24,7 @@ noinst_HEADERS = libmemcached_probes.h \ memcached_io.h \ common.h -lib_LTLIBRARIES = libmemcached.la libmemcachedPlus.la +lib_LTLIBRARIES = libmemcached.la libmemcached_la_SOURCES = crc.c \ hsieh_hash.c \ @@ -57,10 +57,6 @@ libmemcached_la_SOURCES = crc.c \ libmemcached_la_LIBADD = libmemcached_la_LDFLAGS = -version-info $(MEMCACHED_LIBRARY_VERSION) -libmemcachedPlus_la_SOURCES = memcachedplus.cpp -libmemcachedPlus_la_LIBADD = -libmemcachedPlus_la_LDFLAGS = -version-info $(MEMCACHED_LIBRARY_VERSION) - if HAVE_DTRACE libmemcached_la_LIBADD += libmemcached_probes.o endif diff --git a/lib/memcachedplus.cpp b/lib/memcachedplus.cpp deleted file mode 100644 index f092aa56..00000000 --- a/lib/memcachedplus.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - Memcached library -*/ - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include -#include - -Memcached::Memcached() -{ - memcached_create(&memc); -} - -Memcached::Memcached(memcached_st *clone) -{ - WATCHPOINT; - memcached_clone(&memc, clone); - WATCHPOINT; -} - -char *Memcached::get(char *key, size_t *value_length) -{ - uint32_t flags; - memcached_return rc; - - return memcached_get(&memc, key, strlen(key), - value_length, &flags, &rc); -} - -memcached_return Memcached::set(char *key, char *value, size_t value_length) -{ - return memcached_set(&memc, key, strlen(key), - value, value_length, - (time_t)0, (uint32_t)0); -} diff --git a/tests/Makefile.am b/tests/Makefile.am index 06818c3a..e76d1c14 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -22,7 +22,7 @@ testapp_SOURCES = test.c function.c ../src/generator.c ../src/execute.c testapp_LDADD = $(LDADDS) testplus_SOURCES = test.c plus.cpp -testplus_LDADD = $(LDADDS) ../lib/libmemcachedPlus.la +testplus_LDADD = $(LDADDS) ../lib/libmemcached.la record: ./testapp > output.res