Commit 76749dfb by Patrick Steinhardt

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.
parent ba9725a2
...@@ -482,7 +482,7 @@ int git_config_parse( ...@@ -482,7 +482,7 @@ int git_config_parse(
git_config_parser_variable_cb on_variable, git_config_parser_variable_cb on_variable,
git_config_parser_comment_cb on_comment, git_config_parser_comment_cb on_comment,
git_config_parser_eof_cb on_eof, git_config_parser_eof_cb on_eof,
void *data) void *payload)
{ {
git_parse_ctx *ctx; git_parse_ctx *ctx;
char *current_section = NULL, *var_name = NULL, *var_value = NULL; char *current_section = NULL, *var_name = NULL, *var_value = NULL;
...@@ -522,7 +522,7 @@ int git_config_parse( ...@@ -522,7 +522,7 @@ int git_config_parse(
git_parse_advance_chars(ctx, result); git_parse_advance_chars(ctx, result);
if (on_section) 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 * After we've parsed the section header we may not be
* done with the line. If there's still data in there, * done with the line. If there's still data in there,
...@@ -542,13 +542,13 @@ int git_config_parse( ...@@ -542,13 +542,13 @@ int git_config_parse(
case ';': case ';':
case '#': case '#':
if (on_comment) { if (on_comment) {
result = on_comment(parser, line_start, line_len, data); result = on_comment(parser, line_start, line_len, payload);
} }
break; break;
default: /* assume variable declaration */ default: /* assume variable declaration */
if ((result = parse_variable(parser, &var_name, &var_value)) == 0 && on_variable) { 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_name);
git__free(var_value); git__free(var_value);
} }
...@@ -561,7 +561,7 @@ int git_config_parse( ...@@ -561,7 +561,7 @@ int git_config_parse(
} }
if (on_eof) if (on_eof)
result = on_eof(parser, current_section, data); result = on_eof(parser, current_section, payload);
out: out:
git__free(current_section); git__free(current_section);
......
...@@ -34,7 +34,7 @@ typedef int (*git_config_parser_section_cb)( ...@@ -34,7 +34,7 @@ typedef int (*git_config_parser_section_cb)(
const char *current_section, const char *current_section,
const char *line, const char *line,
size_t line_len, size_t line_len,
void *data); void *payload);
typedef int (*git_config_parser_variable_cb)( typedef int (*git_config_parser_variable_cb)(
git_config_parser *parser, git_config_parser *parser,
...@@ -43,18 +43,18 @@ typedef int (*git_config_parser_variable_cb)( ...@@ -43,18 +43,18 @@ typedef int (*git_config_parser_variable_cb)(
const char *var_value, const char *var_value,
const char *line, const char *line,
size_t line_len, size_t line_len,
void *data); void *payload);
typedef int (*git_config_parser_comment_cb)( typedef int (*git_config_parser_comment_cb)(
git_config_parser *parser, git_config_parser *parser,
const char *line, const char *line,
size_t line_len, size_t line_len,
void *data); void *payload);
typedef int (*git_config_parser_eof_cb)( typedef int (*git_config_parser_eof_cb)(
git_config_parser *parser, git_config_parser *parser,
const char *current_section, const char *current_section,
void *data); void *payload);
int git_config_parse( int git_config_parse(
git_config_parser *parser, git_config_parser *parser,
...@@ -62,6 +62,6 @@ int git_config_parse( ...@@ -62,6 +62,6 @@ int git_config_parse(
git_config_parser_variable_cb on_variable, git_config_parser_variable_cb on_variable,
git_config_parser_comment_cb on_comment, git_config_parser_comment_cb on_comment,
git_config_parser_eof_cb on_eof, git_config_parser_eof_cb on_eof,
void *data); void *payload);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment