ref: 0a2dfe5555c4e6a6c2c262e422b19c6ccb59e0b5
parent: 03267fc46dfa80912ad042a9f7104c8810c07f53
author: Anthony House <[email protected]>
date: Sat Nov 24 12:59:29 EST 2018
got mutate char star donish. testing it quick
--- a/mutate.c
+++ b/mutate.c
@@ -44,14 +44,23 @@
void
mut_charstar(char** in_val, int *round)
{
- if(*round == ROUND_NUM)
+ // if not round 1, free the previously malloc-ed memory
+ if(*round != ROUND_NUM)
+ free(*in_val);
+
+ const int MAX_SIZE = 1024;
+ int size = rand() % MAX_SIZE + 1;
+
+ *in_val = malloc(sizeof(char) * size);
+
+ int i;
+ for(i=0; i < size); i++)
{
- //*in_val = rand();
+ (*ptrStr)[i] = 'b';
}
- else
- {
+ (*ptrStr)[size - 1] = '\0';
- }
+ dolog("%s\n", *in_val);
}
void