projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge of all doc fixes.
[awesomized/libmemcached]
/
libmemcached
/
memcached.c
diff --git
a/libmemcached/memcached.c
b/libmemcached/memcached.c
index f3f3c4a6f4c612144b6fe2851c77890898e3a600..120c2087b159d12a3f6d998ce1d569c270a27eea 100644
(file)
--- a/
libmemcached/memcached.c
+++ b/
libmemcached/memcached.c
@@
-213,19
+213,29
@@
memcached_st *memcached_create_with_options(const char *string, size_t length)
memcached_st *self= memcached_create(NULL);
if (! self)
memcached_st *self= memcached_create(NULL);
if (! self)
+ {
+ errno= ENOMEM;
return NULL;
return NULL;
+ }
memcached_return_t rc;
memcached_return_t rc;
- if ((rc= memcached_parse_configuration(self, string, length)) != MEMCACHED_SUCCESS)
+ rc= memcached_parse_configuration(self, string, length);
+
+ if (rc == MEMCACHED_SUCCESS && memcached_parse_filename(self))
{
{
- r
eturn self
;
+ r
c= memcached_parse_configure_file(self, memcached_parse_filename(self), memcached_parse_filename_length(self))
;
}
}
- if (memcached_parse_filename(self))
+
+ if (rc != MEMCACHED_SUCCESS)
{
{
- rc= memcached_parse_configure_file(self, memcached_parse_filename(self), memcached_parse_filename_length(self));
+ memcached_free(self);
+ errno= EINVAL;
+ return NULL;
}
}
+ errno= 0;
+
return self;
}
return self;
}
@@
-252,6
+262,9
@@
memcached_return_t memcached_reset(memcached_st *ptr)
void memcached_servers_reset(memcached_st *ptr)
{
void memcached_servers_reset(memcached_st *ptr)
{
+ if (! ptr)
+ return;
+
memcached_server_list_free(memcached_server_list(ptr));
memcached_server_list_set(ptr, NULL);
memcached_server_list_free(memcached_server_list(ptr));
memcached_server_list_set(ptr, NULL);
@@
-266,6
+279,9
@@
void memcached_servers_reset(memcached_st *ptr)
void memcached_reset_last_disconnected_server(memcached_st *ptr)
{
void memcached_reset_last_disconnected_server(memcached_st *ptr)
{
+ if (! ptr)
+ return;
+
if (ptr->last_disconnected_server)
{
memcached_server_free(ptr->last_disconnected_server);
if (ptr->last_disconnected_server)
{
memcached_server_free(ptr->last_disconnected_server);
@@
-275,6
+291,9
@@
void memcached_reset_last_disconnected_server(memcached_st *ptr)
void memcached_free(memcached_st *ptr)
{
void memcached_free(memcached_st *ptr)
{
+ if (! ptr)
+ return;
+
_free(ptr, true);
}
_free(ptr, true);
}