diff options
| author | J08nY | 2017-10-17 21:45:04 +0200 |
|---|---|---|
| committer | J08nY | 2017-10-17 21:45:04 +0200 |
| commit | b09586f3cca80ec3409c4e34a2fae22974c43d56 (patch) | |
| tree | d804f9884c4b2891d77c816af8c428c01a63ab43 /src/util/str.c | |
| parent | 3b573a6a432af1909224ff003cfcaadbc5d84308 (diff) | |
| download | ecgen-b09586f3cca80ec3409c4e34a2fae22974c43d56.tar.gz ecgen-b09586f3cca80ec3409c4e34a2fae22974c43d56.tar.zst ecgen-b09586f3cca80ec3409c4e34a2fae22974c43d56.zip | |
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 |
