X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fgenerator.cc;h=df805153ce29327e51e93d73842fe0d66ba099b4;hb=04e4d81e039c4aa1f048782c13a6771e8aa2172c;hp=011ed3a499bb778ed5963d3695d4cb48088967b3;hpb=956d15b5b1f3f3518eb374a3a9e0393e9dacd3b6;p=awesomized%2Flibmemcached diff --git a/clients/generator.cc b/clients/generator.cc index 011ed3a4..df805153 100644 --- a/clients/generator.cc +++ b/clients/generator.cc @@ -1,4 +1,5 @@ /* LibMemcached + * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2006-2009 Brian Aker * All rights reserved. * @@ -9,7 +10,7 @@ * */ -#include +#include #include @@ -19,7 +20,7 @@ #include #include -#include "generator.h" +#include "clients/generator.h" /* Use this for string generation */ static const char ALPHANUMERICS[]= @@ -32,26 +33,32 @@ static size_t get_alpha_num(void) return (size_t)random() % ALPHANUMERICS_SIZE; } -static void get_random_string(char *buffer, size_t size) +void get_random_string(char *buffer, size_t size) { char *buffer_ptr= buffer; while (--size) + { *buffer_ptr++= ALPHANUMERICS[get_alpha_num()]; + } *buffer_ptr++= ALPHANUMERICS[get_alpha_num()]; } void pairs_free(pairs_st *pairs) { if (pairs == NULL) + { return; + } /* We free until we hit the null pair we stores during creation */ for (uint32_t x= 0; pairs[x].key; x++) { free(pairs[x].key); if (pairs[x].value) + { free(pairs[x].value); + } } free(pairs);