diff options
Diffstat (limited to 'src/util/str.c')
| -rw-r--r-- | src/util/str.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/util/str.c b/src/util/str.c new file mode 100644 index 0000000..933eb83 --- /dev/null +++ b/src/util/str.c @@ -0,0 +1,21 @@ +/* + * ecgen, tool for generating Elliptic curve domain parameters + * Copyright (C) 2017 J08nY + */ +#include "str.h" +#include <string.h> +#include "util/memory.h" + +char *str_join(char *strings[], size_t len) { + size_t total = 0; + for (size_t i = 0; i < len; ++i) { + if (strings[i]) total += strlen(strings[i]); + } + char *result = try_calloc(total); + for (size_t i = 0; i < len; ++i) { + if (strings[i]) { + strcat(result, strings[i]); + } + } + return result; +}
\ No newline at end of file |
