From: Brian Aker Date: Wed, 15 Jul 2009 10:48:15 +0000 (-0700) Subject: Fix for gcc 4.4 error. X-Git-Tag: 0.32~15 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=f6ae31806fbccf6c2440bd246b555b41cf7b4307;p=m6w6%2Flibmemcached Fix for gcc 4.4 error. --- diff --git a/clients/generator.c b/clients/generator.c index 091b2808..cd1a17bf 100644 --- a/clients/generator.c +++ b/clients/generator.c @@ -13,13 +13,18 @@ static const char ALPHANUMERICS[]= #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) - *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)