summaryrefslogtreecommitdiffstats
path: root/String.c
diff options
context:
space:
mode:
Diffstat (limited to 'String.c')
-rw-r--r--String.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/String.c b/String.c
index 2ee24ac0..81e9eeeb 100644
--- a/String.c
+++ b/String.c
@@ -55,7 +55,8 @@ inline int String_eq(const char* s1, const char* s2) {
return (strcmp(s1, s2) == 0);
}
-char** String_split(const char* s, char sep) {
+char** String_split(const char* s, char sep, int* n) {
+ *n = 0;
const int rate = 10;
char** out = (char**) malloc(sizeof(char*) * rate);
int ctr = 0;
@@ -83,6 +84,7 @@ char** String_split(const char* s, char sep) {
}
out = realloc(out, sizeof(char*) * (ctr + 1));
out[ctr] = NULL;
+ *n = ctr;
return out;
}