projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Fix compile issue for debug.
[awesomized/libmemcached]
/
libmemcached
/
string.c
diff --git
a/libmemcached/string.c
b/libmemcached/string.c
index f708f8d4ae3d66b17a36fbc3af41096606ded25e..10a295814ddb9d8e1fd21d5218854041c0cd3016 100644
(file)
--- a/
libmemcached/string.c
+++ b/
libmemcached/string.c
@@
-32,7
+32,9
@@
inline static memcached_return_t _string_check(memcached_string_st *string, size
new_value= libmemcached_realloc(string->root, string->string, new_size);
if (new_value == NULL)
new_value= libmemcached_realloc(string->root, string->string, new_size);
if (new_value == NULL)
+ {
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
string->string= new_value;
string->end= string->string + current_offset;
string->string= new_value;
string->end= string->string + current_offset;
@@
-80,7
+82,12
@@
memcached_string_st *memcached_string_create(const memcached_st *memc, memcached
rc= _string_check(self, initial_size);
if (rc != MEMCACHED_SUCCESS)
{
rc= _string_check(self, initial_size);
if (rc != MEMCACHED_SUCCESS)
{
+ if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE)
+ {
+ ((memcached_st *)memc)->cached_errno= errno;
+ }
libmemcached_free(memc, self);
libmemcached_free(memc, self);
+
return NULL;
}
return NULL;
}
@@
-99,7
+106,9
@@
memcached_return_t memcached_string_append_character(memcached_string_st *string
rc= _string_check(string, 1);
if (rc != MEMCACHED_SUCCESS)
rc= _string_check(string, 1);
if (rc != MEMCACHED_SUCCESS)
+ {
return rc;
return rc;
+ }
*string->end= character;
string->end++;
*string->end= character;
string->end++;
@@
-115,7
+124,9
@@
memcached_return_t memcached_string_append(memcached_string_st *string,
rc= _string_check(string, length);
if (rc != MEMCACHED_SUCCESS)
rc= _string_check(string, length);
if (rc != MEMCACHED_SUCCESS)
+ {
return rc;
return rc;
+ }
WATCHPOINT_ASSERT(length <= string->current_size);
WATCHPOINT_ASSERT(string->string);
WATCHPOINT_ASSERT(length <= string->current_size);
WATCHPOINT_ASSERT(string->string);
@@
-201,3
+212,12
@@
void memcached_string_set_length(memcached_string_st *self, size_t length)
{
self->end= self->string + length;
}
{
self->end= self->string + length;
}
+
+memcached_string_t memcached_string_make(const char *str, size_t length)
+{
+ memcached_string_t tmp;
+ tmp.c_str= str;
+ tmp.size= length;
+
+ return tmp;
+}