Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary...
[awesomized/libmemcached] / libmemcached / memcached_key.c
1 #include "common.h"
2
3 memcached_return memcachd_key_test(char **keys, size_t *key_length,
4 unsigned int number_of_keys)
5 {
6 uint32_t x;
7 memcached_return rc;
8
9 for (x= 0; x < number_of_keys; x++)
10 {
11 size_t y;
12
13 rc= memcached_validate_key_length(*(key_length + x), false);
14 if (rc != MEMCACHED_SUCCESS)
15 return rc;
16
17
18
19 for (y= 0; y < *(key_length + x); y++)
20 {
21 if ((isgraph(keys[x][y])) == 0)
22 return MEMCACHED_BAD_KEY_PROVIDED;
23 }
24 }
25
26 return MEMCACHED_SUCCESS;
27 }
28