config_parse: rename `data` parameter to `payload` for clarity By convention, parameters that get passed to callbacks are usually named `payload` in our codebase. Rename the `data` parameters in the configuration parser callbacks to `payload` to avoid confusion.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
diff --git a/src/config_parse.c b/src/config_parse.c
index 46dce40..6354f52 100644
--- a/src/config_parse.c
+++ b/src/config_parse.c
@@ -482,7 +482,7 @@ int git_config_parse(
git_config_parser_variable_cb on_variable,
git_config_parser_comment_cb on_comment,
git_config_parser_eof_cb on_eof,
- void *data)
+ void *payload)
{
git_parse_ctx *ctx;
char *current_section = NULL, *var_name = NULL, *var_value = NULL;
@@ -522,7 +522,7 @@ int git_config_parse(
git_parse_advance_chars(ctx, result);
if (on_section)
- result = on_section(parser, current_section, line_start, line_len, data);
+ result = on_section(parser, current_section, line_start, line_len, payload);
/*
* After we've parsed the section header we may not be
* done with the line. If there's still data in there,
@@ -542,13 +542,13 @@ int git_config_parse(
case ';':
case '#':
if (on_comment) {
- result = on_comment(parser, line_start, line_len, data);
+ result = on_comment(parser, line_start, line_len, payload);
}
break;
default: /* assume variable declaration */
if ((result = parse_variable(parser, &var_name, &var_value)) == 0 && on_variable) {
- result = on_variable(parser, current_section, var_name, var_value, line_start, line_len, data);
+ result = on_variable(parser, current_section, var_name, var_value, line_start, line_len, payload);
git__free(var_name);
git__free(var_value);
}
@@ -561,7 +561,7 @@ int git_config_parse(
}
if (on_eof)
- result = on_eof(parser, current_section, data);
+ result = on_eof(parser, current_section, payload);
out:
git__free(current_section);
diff --git a/src/config_parse.h b/src/config_parse.h
index 4db31bd..3eef7d3 100644
--- a/src/config_parse.h
+++ b/src/config_parse.h
@@ -34,7 +34,7 @@ typedef int (*git_config_parser_section_cb)(
const char *current_section,
const char *line,
size_t line_len,
- void *data);
+ void *payload);
typedef int (*git_config_parser_variable_cb)(
git_config_parser *parser,
@@ -43,18 +43,18 @@ typedef int (*git_config_parser_variable_cb)(
const char *var_value,
const char *line,
size_t line_len,
- void *data);
+ void *payload);
typedef int (*git_config_parser_comment_cb)(
git_config_parser *parser,
const char *line,
size_t line_len,
- void *data);
+ void *payload);
typedef int (*git_config_parser_eof_cb)(
git_config_parser *parser,
const char *current_section,
- void *data);
+ void *payload);
int git_config_parse(
git_config_parser *parser,
@@ -62,6 +62,6 @@ int git_config_parse(
git_config_parser_variable_cb on_variable,
git_config_parser_comment_cb on_comment,
git_config_parser_eof_cb on_eof,
- void *data);
+ void *payload);
#endif