+ if (string)
+ {
+ memset(string, 0, sizeof(memcached_string_st));
+ string->is_allocated= MEMCACHED_NOT_ALLOCATED;
+ }
+ else
+ {
+ if (ptr->call_malloc)
+ string= (memcached_string_st *)ptr->call_malloc(ptr, sizeof(memcached_string_st));
+ else
+ string= (memcached_string_st *)malloc(sizeof(memcached_string_st));
+
+ if (string == NULL)
+ return NULL;
+ memset(string, 0, sizeof(memcached_string_st));
+ string->is_allocated= MEMCACHED_ALLOCATED;
+ }
+ string->block_size= MEMCACHED_BLOCK_SIZE;
+ string->root= ptr;
+
+ rc= memcached_string_check(string, initial_size);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ if (ptr->call_free)
+ ptr->call_free(ptr, string);
+ else
+ free(string);
+