projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Updated for custom hash functions/setting functions.
[awesomized/libmemcached]
/
libmemcached
/
callback.c
diff --git
a/libmemcached/callback.c
b/libmemcached/callback.c
index b0ddfc2ba0d394c311ba9c39f39c1703cc6a2d97..29fcd1f8429de08ad9c676d5c67769f60b76f384 100644
(file)
--- a/
libmemcached/callback.c
+++ b/
libmemcached/callback.c
@@
-9,17
+9,17
@@
*
*/
*
*/
-#include "common.h"
+#include "common.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
-/*
+/*
These functions provide data and function callback support
*/
These functions provide data and function callback support
*/
-memcached_return_t memcached_callback_set(memcached_st *ptr,
- memcached_callback_t flag,
+memcached_return_t memcached_callback_set(memcached_st *ptr,
+ const memcached_callback_t flag,
void *data)
{
switch (flag)
void *data)
{
switch (flag)
@@
-38,7
+38,7
@@
memcached_return_t memcached_callback_set(memcached_st *ptr,
}
if ((key_length > MEMCACHED_PREFIX_KEY_MAX_SIZE -1)
}
if ((key_length > MEMCACHED_PREFIX_KEY_MAX_SIZE -1)
- || (str
cpy(ptr->prefix_key, key
) == NULL))
+ || (str
ncpy(ptr->prefix_key, key, MEMCACHED_PREFIX_KEY_MAX_SIZE
) == NULL))
{
ptr->prefix_key_length= 0;
return MEMCACHED_BAD_KEY_PROVIDED;
{
ptr->prefix_key_length= 0;
return MEMCACHED_BAD_KEY_PROVIDED;
@@
-50,7
+50,7
@@
memcached_return_t memcached_callback_set(memcached_st *ptr,
}
else
{
}
else
{
-
memset(ptr->prefix_key, 0, MEMCACHED_PREFIX_KEY_MAX_SIZE)
;
+
ptr->prefix_key[0]= 0
;
ptr->prefix_key_length= 0;
}
ptr->prefix_key_length= 0;
}
@@
-105,6
+105,7
@@
memcached_return_t memcached_callback_set(memcached_st *ptr,
ptr->delete_trigger= func;
break;
}
ptr->delete_trigger= func;
break;
}
+ case MEMCACHED_CALLBACK_MAX:
default:
return MEMCACHED_FAILURE;
}
default:
return MEMCACHED_FAILURE;
}
@@
-112,8
+113,8
@@
memcached_return_t memcached_callback_set(memcached_st *ptr,
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
-void *memcached_callback_get(memcached_st *ptr,
- memcached_callback_t flag,
+void *memcached_callback_get(memcached_st *ptr,
+
const
memcached_callback_t flag,
memcached_return_t *error)
{
memcached_return_t local_error;
memcached_return_t *error)
{
memcached_return_t local_error;
@@
-125,15
+126,15
@@
void *memcached_callback_get(memcached_st *ptr,
{
case MEMCACHED_CALLBACK_PREFIX_KEY:
{
{
case MEMCACHED_CALLBACK_PREFIX_KEY:
{
- if (ptr->prefix_key
[0] == 0
)
+ if (ptr->prefix_key
_length
)
{
{
- *error= MEMCACHED_
FAILURE
;
- return
NULL
;
+ *error= MEMCACHED_
SUCCESS
;
+ return
(void *)ptr->prefix_key
;
}
else
{
}
else
{
- *error= MEMCACHED_
SUCCESS
;
- return
(void *)ptr->prefix_key
;
+ *error= MEMCACHED_
FAILURE
;
+ return
NULL
;
}
}
case MEMCACHED_CALLBACK_USER_DATA:
}
}
case MEMCACHED_CALLBACK_USER_DATA:
@@
-178,6
+179,7
@@
void *memcached_callback_get(memcached_st *ptr,
*error= ptr->delete_trigger ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
return *(void **)&ptr->delete_trigger;
}
*error= ptr->delete_trigger ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
return *(void **)&ptr->delete_trigger;
}
+ case MEMCACHED_CALLBACK_MAX:
default:
WATCHPOINT_ASSERT(0);
*error= MEMCACHED_FAILURE;
default:
WATCHPOINT_ASSERT(0);
*error= MEMCACHED_FAILURE;