summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-01 11:15:48 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-01 11:15:48 -0300
commitd5d1da19bb6b325ea57aaac41bfbc0ddf10f9d66 (patch)
tree612c827de8eeebe0179adc7008acae7d690313a3 /git.c
parentd79150f4b7731e6309fc5784c9c3a481300fbd9a (diff)
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).
Diffstat (limited to 'git.c')
-rw-r--r--git.c6
1 files 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);