xref: /6.0.3/moxi/conflate/util.c (revision d0366df5)
1#include <stdio.h>
2#include <stdlib.h>
3#include <platform/cbassert.h>
4#include <string.h>
5
6#include <libconflate/conflate.h>
7
8char* safe_strdup(const char* in) {
9    int len = strlen(in);
10    char *rv = calloc(len + 1, sizeof(char));
11    cb_assert(rv);
12    memcpy(rv, in, len);
13    return rv;
14}
15
16void free_string_list(char **vals)
17{
18    int i = 0;
19    for (i = 0; vals[i]; i++) {
20        free(vals[i]);
21    }
22    free(vals);
23}
24