config_file: rename parse_data struct The struct `parse_data` sounds as if it was defined and passed to us from the configuration parser, which is not true. Instead, `parse_data` is specific to the diskfile backend parsing logic. Rename it to `diskfile_parse_state` to make that clearer. This also follows existing naming patterns with the "diskfile" prefix.
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
diff --git a/src/config_file.c b/src/config_file.c
index c621a41..b3fda80 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -69,6 +69,14 @@ typedef struct {
diskfile_backend *snapshot_from;
} diskfile_readonly_backend;
+typedef struct {
+ const git_repository *repo;
+ const char *file_path;
+ git_strmap *values;
+ git_config_level_t level;
+ unsigned int depth;
+} diskfile_parse_state;
+
static int config_read(git_strmap *values, const git_repository *repo, git_config_file *file, git_config_level_t level, int depth);
static int config_write(diskfile_backend *cfg, const char *orig_key, const char *key, const regex_t *preg, const char *value);
static char *escape_value(const char *ptr);
@@ -869,16 +877,8 @@ static char *escape_value(const char *ptr)
return git_buf_detach(&buf);
}
-struct parse_data {
- const git_repository *repo;
- const char *file_path;
- git_strmap *values;
- git_config_level_t level;
- unsigned int depth;
-};
-
static int parse_include(git_config_parser *reader,
- struct parse_data *parse_data, const char *file)
+ diskfile_parse_state *parse_data, const char *file)
{
struct config_file *include;
git_buf path = GIT_BUF_INIT;
@@ -980,7 +980,7 @@ static const struct {
};
static int parse_conditional_include(git_config_parser *reader,
- struct parse_data *parse_data, const char *section, const char *file)
+ diskfile_parse_state *parse_data, const char *section, const char *file)
{
char *condition;
size_t i;
@@ -1021,7 +1021,7 @@ static int read_on_variable(
size_t line_len,
void *data)
{
- struct parse_data *parse_data = (struct parse_data *)data;
+ diskfile_parse_state *parse_data = (diskfile_parse_state *)data;
git_buf buf = GIT_BUF_INIT;
git_config_entry *entry;
int result = 0;
@@ -1069,7 +1069,7 @@ static int config_read(
git_config_level_t level,
int depth)
{
- struct parse_data parse_data;
+ diskfile_parse_state parse_data;
git_config_parser reader;
git_buf contents = GIT_BUF_INIT;
int error;