Skip to content

Commit 76749df

Browse files
committed
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 parent ba9725a commit 76749df

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/config_parse.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ int git_config_parse(
482482
git_config_parser_variable_cb on_variable,
483483
git_config_parser_comment_cb on_comment,
484484
git_config_parser_eof_cb on_eof,
485-
void *data)
485+
void *payload)
486486
{
487487
git_parse_ctx *ctx;
488488
char *current_section = NULL, *var_name = NULL, *var_value = NULL;
@@ -522,7 +522,7 @@ int git_config_parse(
522522
git_parse_advance_chars(ctx, result);
523523

524524
if (on_section)
525-
result = on_section(parser, current_section, line_start, line_len, data);
525+
result = on_section(parser, current_section, line_start, line_len, payload);
526526
/*
527527
* After we've parsed the section header we may not be
528528
* done with the line. If there's still data in there,
@@ -542,13 +542,13 @@ int git_config_parse(
542542
case ';':
543543
case '#':
544544
if (on_comment) {
545-
result = on_comment(parser, line_start, line_len, data);
545+
result = on_comment(parser, line_start, line_len, payload);
546546
}
547547
break;
548548

549549
default: /* assume variable declaration */
550550
if ((result = parse_variable(parser, &var_name, &var_value)) == 0 && on_variable) {
551-
result = on_variable(parser, current_section, var_name, var_value, line_start, line_len, data);
551+
result = on_variable(parser, current_section, var_name, var_value, line_start, line_len, payload);
552552
git__free(var_name);
553553
git__free(var_value);
554554
}
@@ -561,7 +561,7 @@ int git_config_parse(
561561
}
562562

563563
if (on_eof)
564-
result = on_eof(parser, current_section, data);
564+
result = on_eof(parser, current_section, payload);
565565

566566
out:
567567
git__free(current_section);

src/config_parse.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef int (*git_config_parser_section_cb)(
3434
const char *current_section,
3535
const char *line,
3636
size_t line_len,
37-
void *data);
37+
void *payload);
3838

3939
typedef int (*git_config_parser_variable_cb)(
4040
git_config_parser *parser,
@@ -43,25 +43,25 @@ typedef int (*git_config_parser_variable_cb)(
4343
const char *var_value,
4444
const char *line,
4545
size_t line_len,
46-
void *data);
46+
void *payload);
4747

4848
typedef int (*git_config_parser_comment_cb)(
4949
git_config_parser *parser,
5050
const char *line,
5151
size_t line_len,
52-
void *data);
52+
void *payload);
5353

5454
typedef int (*git_config_parser_eof_cb)(
5555
git_config_parser *parser,
5656
const char *current_section,
57-
void *data);
57+
void *payload);
5858

5959
int git_config_parse(
6060
git_config_parser *parser,
6161
git_config_parser_section_cb on_section,
6262
git_config_parser_variable_cb on_variable,
6363
git_config_parser_comment_cb on_comment,
6464
git_config_parser_eof_cb on_eof,
65-
void *data);
65+
void *payload);
6666

6767
#endif

0 commit comments

Comments
 (0)