diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-01 11:15:48 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-01 11:15:48 -0300 |
commit | d5d1da19bb6b325ea57aaac41bfbc0ddf10f9d66 (patch) | |
tree | 612c827de8eeebe0179adc7008acae7d690313a3 /git.c | |
parent | d79150f4b7731e6309fc5784c9c3a481300fbd9a (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.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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); |