projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge in updates to make sure exit/return is done properly.
[awesomized/libmemcached]
/
clients
/
execute.c
diff --git
a/clients/execute.c
b/clients/execute.c
index 30fb5f180cca0cf0d1983d665f87d3c6438881f9..dbc102c68af0f062501dfead9e98e9c6be6fb49b 100644
(file)
--- a/
clients/execute.c
+++ b/
clients/execute.c
@@
-1,15
+1,25
@@
+/* LibMemcached
+ * Copyright (C) 2006-2009 Brian Aker
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary:
+ *
+ */
+
/*
Execute a memcached_set() a set of pairs.
Return the number of rows set.
*/
/*
Execute a memcached_set() a set of pairs.
Return the number of rows set.
*/
-#include "libmemcached/common.h"
-
+#include "config.h"
#include "execute.h"
unsigned int execute_set(memcached_st *memc, pairs_st *pairs, unsigned int number_of)
{
#include "execute.h"
unsigned int execute_set(memcached_st *memc, pairs_st *pairs, unsigned int number_of)
{
- memcached_return rc;
+ memcached_return
_t
rc;
unsigned int x;
unsigned int pairs_sent;
unsigned int x;
unsigned int pairs_sent;
@@
-34,7
+44,7
@@
unsigned int execute_set(memcached_st *memc, pairs_st *pairs, unsigned int numbe
*/
unsigned int execute_get(memcached_st *memc, pairs_st *pairs, unsigned int number_of)
{
*/
unsigned int execute_get(memcached_st *memc, pairs_st *pairs, unsigned int number_of)
{
- memcached_return rc;
+ memcached_return
_t
rc;
unsigned int x;
unsigned int retrieved;
unsigned int x;
unsigned int retrieved;
@@
-66,9
+76,9
@@
unsigned int execute_get(memcached_st *memc, pairs_st *pairs, unsigned int numbe
/**
* Callback function to count the number of results
*/
/**
* Callback function to count the number of results
*/
-static memcached_return
callback_counter(
memcached_st *ptr,
- memcached_result_st *result,
- void *context)
+static memcached_return
_t callback_counter(const
memcached_st *ptr,
+
memcached_result_st *result,
+
void *context)
{
(void)ptr;
(void)result;
{
(void)ptr;
(void)result;
@@
-92,22
+102,21
@@
unsigned int execute_mget(memcached_st *memc,
unsigned int number_of)
{
unsigned int retrieved= 0;
unsigned int number_of)
{
unsigned int retrieved= 0;
- memcached_execute_f
unctio
n callbacks[1]= { [0]= &callback_counter };
- memcached_return rc;
+ memcached_execute_fn callbacks[1]= { [0]= &callback_counter };
+ memcached_return
_t
rc;
rc= memcached_mget_execute(memc, keys, key_length,
(size_t)number_of, callbacks, &retrieved, 1);
rc= memcached_mget_execute(memc, keys, key_length,
(size_t)number_of, callbacks, &retrieved, 1);
-
likely
(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOTFOUND ||
+
if
(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOTFOUND ||
rc == MEMCACHED_BUFFERED || rc == MEMCACHED_END)
{
rc= memcached_fetch_execute(memc, callbacks, (void *)&retrieved, 1);
rc == MEMCACHED_BUFFERED || rc == MEMCACHED_END)
{
rc= memcached_fetch_execute(memc, callbacks, (void *)&retrieved, 1);
- unlikely (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_NOTFOUND &&
- rc != MEMCACHED_END)
+ if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_NOTFOUND && rc != MEMCACHED_END)
{
fprintf(stderr, "Failed to execute mget: %s\n",
memcached_strerror(memc, rc));
memcached_quit(memc);
{
fprintf(stderr, "Failed to execute mget: %s\n",
memcached_strerror(memc, rc));
memcached_quit(memc);
- return
0
;
+ return
EXIT_SUCCESS
;
}
}
else
}
}
else
@@
-115,7
+124,7
@@
unsigned int execute_mget(memcached_st *memc,
fprintf(stderr, "Failed to execute mget: %s\n",
memcached_strerror(memc, rc));
memcached_quit(memc);
fprintf(stderr, "Failed to execute mget: %s\n",
memcached_strerror(memc, rc));
memcached_quit(memc);
- return
0
;
+ return
EXIT_SUCCESS
;
}
return retrieved;
}
return retrieved;