Fix for gcc 4.4 error.
authorBrian Aker <brian@gaz>
Wed, 15 Jul 2009 10:48:15 +0000 (03:48 -0700)
committerBrian Aker <brian@gaz>
Wed, 15 Jul 2009 10:48:15 +0000 (03:48 -0700)
clients/generator.c

index 091b280876e18ad1d12757a7d5b45eca90c072b6..cd1a17bfe71059fceb49fff382b7975220284b35 100644 (file)
@@ -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)