summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-07-28 19:24:22 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-07-28 19:24:22 -0300
commit47a5abd3ce92592c87f86d0cf33f57fff687c246 (patch)
tree93b9d4375556a36bc9ad63001f6455c280b21768 /git.c
parent2ddb5741c9d6c8a0942e0a73f66d21617cf378e8 (diff)
keyword: Make `keyword_cb`, and `set_keyword()` return an `int`
`set_keyword()` now checks the return value of the callback to determine whether to return early, fallback to the default, or return an error if the callback returns true, false, and -1 respectivly.
Diffstat (limited to 'git.c')
-rw-r--r--git.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/git.c b/git.c
index 7124a4d..be54aa9 100644
--- a/git.c
+++ b/git.c
@@ -89,7 +89,7 @@ static linked_list *parse_dsv_str(const char *str, const char *delm) {
return tail;
}
-static void parse_patch_list(void *ctx, void *ret, const keyword *key, keyword_val val) {
+static int parse_patch_list(void *ctx, void *ret, const keyword *key, keyword_val val) {
/* Do we actually have a "patches" keyword? */
if (key->type == TYPE_STRING) {
const char *root = (const char *)ctx;
@@ -113,11 +113,13 @@ static void parse_patch_list(void *ctx, void *ret, const keyword *key, keyword_v
}
cleanup_linked_list(patch_list);
+ return 1;
}
}
+ return -1;
}
-static void parse_comment_reply(void *ctx, void *ret, const keyword *key, keyword_val val) {
+static int parse_comment_reply(void *ctx, void *ret, const keyword *key, keyword_val val) {
linked_list *comment_list = *(linked_list **)ctx;
comment *comment = (comment *)ret;
@@ -129,7 +131,7 @@ static void parse_comment_reply(void *ctx, void *ret, const keyword *key, keywor
/* Do we have a match? */
if (comment->reply == reply) {
- return;
+ return 1;
}
}
}
@@ -158,7 +160,7 @@ static void parse_comment_reply(void *ctx, void *ret, const keyword *key, keywor
/* Did we find a reply in the list? */
if (found_reply) {
- return;
+ return 1;
}
}