X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fmemcached.hpp;h=142f167c31398bec78d87e2272fbd43d65b93b86;hb=0b262a1571e2196e988a841d3449b5a4e0a2081a;hp=e0e1485101aaa41c9c7a8593dc379d2ff0b2feab;hpb=a0a194ba0789e0650329d81a5ed12620360789eb;p=awesomized%2Flibmemcached diff --git a/libtest/memcached.hpp b/libtest/memcached.hpp index e0e14851..142f167c 100644 --- a/libtest/memcached.hpp +++ b/libtest/memcached.hpp @@ -39,7 +39,7 @@ #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED inline bool operator== (const memcached_st& memc, const memcached_return_t rc) { - if (memcached_last_error(const_cast(&memc)) == rc) + if (memcached_last_error(&memc) == rc) { return true; } @@ -47,7 +47,7 @@ inline bool operator== (const memcached_st& memc, const memcached_return_t rc) return false; } -inline bool operator!= (const memcached_st& memc, const memcached_return_t rc) +inline bool operator!= (const memcached_st& memc, memcached_return_t rc) { if (memcached_last_error(const_cast(&memc)) != rc) { @@ -57,7 +57,27 @@ inline bool operator!= (const memcached_st& memc, const memcached_return_t rc) return false; } -inline bool operator!= (const memcached_return_t rc, const memcached_st& memc) +inline bool operator== (memcached_st* const memc, memcached_return_t rc) +{ + if (memcached_last_error(memc) == rc) + { + return true; + } + + return false; +} + +inline bool operator!= (memcached_st* const memc, memcached_return_t rc) +{ + if (memcached_last_error(memc) != rc) + { + return true; + } + + return false; +} + +inline bool operator!= (memcached_return_t rc, const memcached_st& memc) { if (memcached_last_error(const_cast(&memc)) != rc) { @@ -66,5 +86,15 @@ inline bool operator!= (const memcached_return_t rc, const memcached_st& memc) return false; } + +inline bool operator!= (memcached_return_t rc, memcached_st* const memc) +{ + if (memcached_last_error(memc) != rc) + { + return true; + } + + return false; +} #endif