summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-01 11:22:59 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-01 11:25:02 -0300
commit6de2da7f73135fcff28d33845e3b73f293125f60 (patch)
tree9fda547f42e9f2fb68ad7a083cb671c2cb07d542 /git.c
parent05c0cd0db19063cd3a4043a5401c00b874ededa7 (diff)
git, keyword: Move `parse_key_value_file()` to `keyword.{c,h}`
Diffstat (limited to 'git.c')
-rw-r--r--git.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/git.c b/git.c
index 2a09841..931ba09 100644
--- a/git.c
+++ b/git.c
@@ -280,55 +280,6 @@ int parse_comment_reply(void *ctx, void *ret, const keyword *key, keyword_val va
return 1;
}
-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 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);
-
- /* Did we hit EOF? */
- if (is_empty(lhs) || is_empty(buf)) {
- break;
- } else {
- int error;
- char *tmp = skip_whitespace(buf);
-
- /* Does the right hand side start with a double, or single quote? */
- if (*tmp == '\"' || *tmp == '\'') {
- const char *delm = (*delm == '\"') ? "\"" : "\'";
- /* Get the string in between the start, and end qoute. */
- rhs = get_str_delm_range(tmp, delm, delm, &buf);
- } else {
- /* Get the rest of the line. */
- rhs = strtok_r(tmp, "\n", &buf);
- }
-
- /* Did we fail to parse the keyword? */
- if (error = parse_keywords(keywords, lhs, rhs, ret, ctx)) {
- log(LOG_WARNING, "Failed to parse keyword \"%s\". Error code: %i", lhs, error);
- ret_val = error;
- }
- }
-
- /* Do we have a parse callback? */
- if (parse_cb != NULL) {
- /* Did the callback return an error. */
- if (parse_cb(&ret, ctx, buf) < 0) {
- ret_val = 7;
- break;
- }
- }
- }
- return ret_val;
- } else {
- return 8;
- }
-}
-
static int is_end_of_comment(void **ret, void *ctx, char *buf) {
/* Do we have at least one blank line? */
if (strspn(buf, "\n") >= 1) {