Skip to content

Commit 3a3a126

Browse files
committed
Change laco_split_by to only split by a character
1 parent 7dbc8b5 commit 3a3a126

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/util.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ bool laco_is_match(const char** matches, const char* test_string) {
3939
return false;
4040
}
4141

42-
char** laco_split_by(const char* split_with, char* string,
42+
char** laco_split_by(const char split_with, char* string,
4343
int ignore_repeats) {
4444
if(string == NULL) return NULL;
4545

4646
char** result = calloc(16, sizeof(char*));
4747
size_t i = 0;
4848

4949
while(1) {
50-
result[i] = strsep(&string, split_with);
50+
result[i] = strsep(&string, &split_with);
5151

5252
if(result[i] == NULL) break;
5353

54-
if(ignore_repeats) ignore_extra(split_with[0], &string);
54+
if(ignore_repeats) ignore_extra(split_with, &string);
5555

5656
i += 1;
5757
}

src/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bool laco_is_match(const char** matches, const char* test_string);
4444
* Break the provided string into an array of strings that are between the
4545
* split_with value. The last value of this array will be NULL.
4646
*/
47-
char** laco_split_by(const char* split_with, char* string,
47+
char** laco_split_by(const char split_with, char* string,
4848
int ignore_repeats);
4949

5050
/* Macro for splitting with spaces */

0 commit comments

Comments
 (0)