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 149437af2d0b21af5ffef2ac992220bea1704242..120c2087b159d12a3f6d998ce1d569c270a27eea 100644
(file)
--- a/
libmemcached/memcached.c
+++ b/
libmemcached/memcached.c
@@
-52,10
+52,8
@@
static const memcached_st global_copy= {
.no_block= false,
.no_reply= false,
.randomize_replica_read= false,
.no_block= false,
.no_reply= false,
.randomize_replica_read= false,
- .reuse_memory= false,
.support_cas= false,
.tcp_nodelay= false,
.support_cas= false,
.tcp_nodelay= false,
- .use_cache_lookups= false,
.use_sort_hosts= false,
.use_udp= false,
.verify_key= false,
.use_sort_hosts= false,
.use_udp= false,
.verify_key= false,
@@
-89,6
+87,7
@@
static inline bool _memcached_init(memcached_st *self)
self->snd_timeout= 0;
self->rcv_timeout= 0;
self->server_failure_limit= 0;
self->snd_timeout= 0;
self->rcv_timeout= 0;
self->server_failure_limit= 0;
+ self->query_id= 0;
/* TODO, Document why we picked these defaults */
self->io_msg_watermark= 500;
/* TODO, Document why we picked these defaults */
self->io_msg_watermark= 500;
@@
-130,7
+129,7
@@
static inline bool _memcached_init(memcached_st *self)
static void _free(memcached_st *ptr, bool release_st)
{
/* If we have anything open, lets close it now */
static void _free(memcached_st *ptr, bool release_st)
{
/* If we have anything open, lets close it now */
-
memcache
d_quit(ptr);
+
sen
d_quit(ptr);
memcached_server_list_free(memcached_server_list(ptr));
memcached_result_free(&ptr->result);
memcached_server_list_free(memcached_server_list(ptr));
memcached_result_free(&ptr->result);
@@
-214,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;
}
@@
-237,9
+246,11
@@
memcached_return_t memcached_reset(memcached_st *ptr)
return MEMCACHED_INVALID_ARGUMENTS;
bool stored_is_allocated= memcached_is_allocated(ptr);
return MEMCACHED_INVALID_ARGUMENTS;
bool stored_is_allocated= memcached_is_allocated(ptr);
+ uint64_t query_id= ptr->query_id;
_free(ptr, false);
memcached_create(ptr);
memcached_set_allocated(ptr, stored_is_allocated);
_free(ptr, false);
memcached_create(ptr);
memcached_set_allocated(ptr, stored_is_allocated);
+ ptr->query_id= query_id;
if (ptr->configure.filename)
{
if (ptr->configure.filename)
{
@@
-251,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);
@@
-265,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);
@@
-274,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);
}