From d5d1da19bb6b325ea57aaac41bfbc0ddf10f9d66 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 1 Aug 2022 11:15:48 -0300 Subject: git: Rename `parse_colon_key_value_file()` to `parse_key_value_file()`, and make it more generic This will allow us to parse pretty much anything with a key, value pair seperated by some delimiter(s). --- git.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git.c b/git.c index 003d9b6..34ff394 100644 --- a/git.c +++ b/git.c @@ -282,13 +282,13 @@ int parse_comment_reply(void *ctx, void *ret, const keyword *key, keyword_val va typedef int (parse_callback)(void **ret, void *ctx, char *buf); -static int parse_colon_key_value_file(void *ret, void *ctx, const keyword **keywords, char *buf, parse_callback *parse_cb) { +static int parse_key_value_file(void *ret, void *ctx, const keyword **keywords, char *buf, const char *delm, parse_callback *parse_cb) { if (buf != NULL) { int ret_val = 0; for (;;) { char *lhs, *rhs; - /* Find the keyword before the colon. */ - lhs = strtok_r(skip_whitespace(buf), ":", &buf); + /* Find the keyword before the delimiter(s). */ + lhs = strtok_r(skip_whitespace(buf), delm, &buf); /* Remove any whitespace ahead of us. */ lhs = strtok_r(lhs, " \t\v\r\n", &rhs); -- cgit v1.2.3-13-gbd6f