Some patches for cmemcache

FreeWizard freewizard at gmail.com
Tue May 29 16:19:15 UTC 2007


here are some other patches that fix some problems(segfault maybe)

cmemcache.c:
 memc_server_t* memc_find_server(memc_server_list_t* slist, const char* key) {
         hc_slot_t* m = hashcircle_find_key(slist->circle, key, strlen(key));
+        if (NULL==m) return NULL; //the previous func may return null
if no server alive

         memc_server_t* server = NULL;

cmemcache.h:
         size_t server_count;
-        hc_slot_t** knownservers;
+        memc_server_t** knownservers; //typo?
         memc_server_t* head; // list of server connections
         memc_get_results_t* results; // result buffer
 } memc_server_list_t;

php_cmemcache/php_cmemcache.c:
 #define MEMC_PHP_STORE_WRAPPER(func) { \
      MEMC_PHP_VARS; \
         char* data; \
-        int data_len; \
+        size_t data_len; //must be size_t here or it'll be always 0 in x86_64 \
         uint32_t flags; \
         long expire; \

Index: hashcircle.c
===================================================================
--- hashcircle.c        £¨°æ±¾ 19£(c)
+++ hashcircle.c        £¨¹¤×÷¸±±¾£(c)
@@ -84,7 +84,7 @@
                  }
         }

-        return first;
+        return guess; //i guess it's a typo :P
 }

On 5/29/07, Alex <alexs at advfn.com> wrote:
> Thanks for the patches, I'll try and get them checked in tonight.
>


More information about the memcached mailing list