Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
Fix error detection in quad_split_string_append()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlarsson committed Dec 21, 2021
1 parent 82d7c2f commit 216885e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ extract_first_word (const char **p, char **ret, const char *separators, QuadSpli
return 1;
}

void
gboolean
quad_split_string_append (GPtrArray *array,
const char *s,
const char *separators,
Expand All @@ -508,13 +508,15 @@ quad_split_string_append (GPtrArray *array,

r = extract_first_word (&s, &word, separators, flags);
if (r < 0)
return NULL;
return FALSE;

if (r == 0)
break;

g_ptr_array_add (array, g_steal_pointer (&word));
}

return TRUE;
}

GPtrArray *
Expand Down
2 changes: 1 addition & 1 deletion src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ char * quad_apply_line_continuation (const char *raw_string);
GPtrArray * quad_split_string (const char *s,
const char *separators,
QuadSplitFlags flags);
void quad_split_string_append (GPtrArray *array,
gboolean quad_split_string_append (GPtrArray *array,
const char *s,
const char *separators,
QuadSplitFlags flags);
Expand Down

0 comments on commit 216885e

Please sign in to comment.