blob: b3c7ae1c37a1b5bb84235e7624af2625d834af4e [file] [log] [blame]
Brad Bishopa669a502021-08-03 16:01:43 -04001#include "utils.h"
2
3#include <stdlib.h>
4#include <string.h>
5
6char** generate_test_sarray(size_t len)
7{
8 static const char testString[] = "test";
9 size_t i;
10 char** ret = calloc(len + 1, sizeof(*ret));
11 if (!ret)
12 return NULL;
13
14 for (i = 0; i < len; ++i)
15 {
16 ret[i] = strdup(testString);
17 if (!ret[i])
18 goto error;
19 }
20
21 return ret;
22
23error:
24 for (i = 0; i < len; ++i)
25 {
26 free(ret[i]);
27 }
28 free(ret);
29
30 return NULL;
31}