X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fgenerator.c;h=793157ef52666e611b4a8fd3a4bb7732876679bd;hb=42a7cc99572d9cf161e9db04f31e123b5431df10;hp=caeda9265d4836dcec0760f465a82ac06c90cd18;hpb=d5afe6f9c8ce6c26d5721d611718cd5f8e75bb25;p=m6w6%2Flibmemcached diff --git a/src/generator.c b/src/generator.c index caeda926..793157ef 100644 --- a/src/generator.c +++ b/src/generator.c @@ -36,7 +36,7 @@ void pairs_free(pairs_st *pairs) free(pairs); } -pairs_st *pairs_generate(unsigned long long number_of) +pairs_st *pairs_generate(unsigned long long number_of, size_t value_length) { unsigned int x; pairs_st *pairs; @@ -56,11 +56,11 @@ pairs_st *pairs_generate(unsigned long long number_of) get_random_string(pairs[x].key, 100); pairs[x].key_length= 100; - pairs[x].value= (char *)malloc(sizeof(char) * 400); + pairs[x].value= (char *)malloc(sizeof(char) * value_length); if (!pairs[x].value) goto error; - get_random_string(pairs[x].value, 400); - pairs[x].value_length= 400; + get_random_string(pairs[x].value, value_length); + pairs[x].value_length= value_length; } return pairs;