memcap works, though it does nothing useful at the moment :)
[m6w6/libmemcached] / lib / memcached.c
index c636b9b4e994e938cbcca1d1cd32d4abbdda7b16..68c5d3c5ffbbaa3f081fb5b6736d71d603b5dca1 100644 (file)
@@ -1,7 +1,7 @@
 /*
   Memcached library
 */
-#include <memcached.h>
+#include "common.h"
 
 memcached_st *memcached_init(memcached_st *ptr)
 {
@@ -25,19 +25,10 @@ memcached_st *memcached_init(memcached_st *ptr)
 
 void memcached_deinit(memcached_st *ptr)
 {
-  unsigned int x;
-  memcached_host_st *host_ptr;
-
   if (ptr->hosts)
   {
-    for (x= 0; x < ptr->number_of_hosts; x++)
-    {
-      if (ptr->hosts[x].fd == -1)
-        close(ptr->hosts[x].fd);
-      free(ptr->hosts[x].hostname);
-    }
-
-    free(ptr->hosts);
+    memcached_server_list_free(ptr->hosts);
+    ptr->hosts= NULL;
   }
 
   if (ptr->is_allocated == MEMCACHED_ALLOCATED)