projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Updating Patrick's C++ exceptions to build without warnings on solaris.
[m6w6/libmemcached]
/
clients
/
generator.c
diff --git
a/clients/generator.c
b/clients/generator.c
index 091b280876e18ad1d12757a7d5b45eca90c072b6..213246ba2206a3d84916c8503c43c089bc26e975 100644
(file)
--- a/
clients/generator.c
+++ b/
clients/generator.c
@@
-13,13
+13,18
@@
static const char ALPHANUMERICS[]=
#define ALPHANUMERICS_SIZE (sizeof(ALPHANUMERICS)-1)
#define ALPHANUMERICS_SIZE (sizeof(ALPHANUMERICS)-1)
+static size_t get_alpha_num(void)
+{
+ return (size_t)random() % ALPHANUMERICS_SIZE;
+}
+
static void get_random_string(char *buffer, size_t size)
{
char *buffer_ptr= buffer;
while (--size)
static void get_random_string(char *buffer, size_t size)
{
char *buffer_ptr= buffer;
while (--size)
- *buffer_ptr++= ALPHANUMERICS[
random() % ALPHANUMERICS_SIZE
];
- *buffer_ptr++= ALPHANUMERICS[
random() % ALPHANUMERICS_SIZE
];
+ *buffer_ptr++= ALPHANUMERICS[
get_alpha_num()
];
+ *buffer_ptr++= ALPHANUMERICS[
get_alpha_num()
];
}
void pairs_free(pairs_st *pairs)
}
void pairs_free(pairs_st *pairs)
@@
-42,9
+47,7
@@
void pairs_free(pairs_st *pairs)
pairs_st *pairs_generate(uint64_t number_of, size_t value_length)
{
unsigned int x;
pairs_st *pairs_generate(uint64_t number_of, size_t value_length)
{
unsigned int x;
- pairs_st *pairs;
-
- pairs= (pairs_st*)calloc(number_of + 1, sizeof(pairs_st));
+ pairs_st *pairs= calloc((size_t)(number_of + 1), sizeof(pairs_st));
if (!pairs)
goto error;
if (!pairs)
goto error;