summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-04 12:37:56 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-04 12:37:56 -0300
commit39f6692f5b61399091ce4d5a318c5621a4a284ac (patch)
tree118b68b29f0913be74039f834196b7cc4f2ede87
parent9660b8af7a810812cb71a7d513532484efd0dd36 (diff)
git: Use `is_empty()`, and `find_delm(),` rather than doing it manually
in `parse_dsv_str()`
-rw-r--r--git.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/git.c b/git.c
index c620342..b070b14 100644
--- a/git.c
+++ b/git.c
@@ -151,7 +151,7 @@ void cleanup_pull_request(pull_request *pr) {
static linked_list *parse_dsv_str(const char *str, const char *delm) {
linked_list *tail = NULL;
- for (; *str != '\0'; str += strspn(str, delm)) {
+ for (; !is_empty(str); str = find_delm((char *)str, delm, 1)) {
/* Get the length of the token. */
size_t tok_len = strcspn(str, delm);
/* Create the token. */
@@ -160,8 +160,6 @@ static linked_list *parse_dsv_str(const char *str, const char *delm) {
memcpy(tok, str, tok_len);
/* Add the token to the list.. */
tail = add_node(&tail, tok);
- /* Move over the token. */
- str += tok_len;
}
return tail;
}