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
)
32 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
34 if (ptr
->hosts
[x
].fd
> 0)
35 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
));