6 memcached_st
*memcached_init(memcached_st
*ptr
)
10 ptr
= (memcached_st
*)malloc(sizeof(memcached_st
));
13 return NULL
; /* MEMCACHED_MEMORY_ALLOCATION_FAILURE */
15 memset(ptr
, 0, sizeof(memcached_st
));
16 ptr
->is_allocated
= MEMCACHED_ALLOCATED
;
20 memset(ptr
, 0, sizeof(memcached_st
));
26 void memcached_deinit(memcached_st
*ptr
)
29 memcached_host_st
*host_ptr
;
33 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
35 if (ptr
->hosts
[x
].fd
== -1)
36 close(ptr
->hosts
[x
].fd
);
37 free(ptr
->hosts
[x
].hostname
);
43 if (ptr
->is_allocated
== MEMCACHED_ALLOCATED
)
46 memset(ptr
, 0, sizeof(memcached_st
));