Commit 1475b981 by Carlos Martín Nieto

config: keep the output parameter at the start of the function

parent c44b9170
...@@ -120,7 +120,7 @@ typedef struct { ...@@ -120,7 +120,7 @@ typedef struct {
diskfile_backend *snapshot_from; diskfile_backend *snapshot_from;
} diskfile_readonly_backend; } diskfile_readonly_backend;
static int config_read(const git_repository *repo, git_strmap *values, struct config_file *file, git_config_level_t level, int depth); static int config_read(git_strmap *values, const git_repository *repo, struct config_file *file, git_config_level_t level, int depth);
static int config_write(diskfile_backend *cfg, const char *key, const regex_t *preg, const char *value); static int config_write(diskfile_backend *cfg, const char *key, const regex_t *preg, const char *value);
static char *escape_value(const char *ptr); static char *escape_value(const char *ptr);
...@@ -297,7 +297,7 @@ static int config_open(git_config_backend *cfg, git_config_level_t level, const ...@@ -297,7 +297,7 @@ static int config_open(git_config_backend *cfg, git_config_level_t level, const
if (!git_path_exists(b->file.path)) if (!git_path_exists(b->file.path))
return 0; return 0;
if (res < 0 || (res = config_read(repo, b->header.values->values, &b->file, level, 0)) < 0) { if (res < 0 || (res = config_read(b->header.values->values, repo, &b->file, level, 0)) < 0) {
refcounted_strmap_free(b->header.values); refcounted_strmap_free(b->header.values);
b->header.values = NULL; b->header.values = NULL;
} }
...@@ -361,7 +361,7 @@ static int config_refresh(git_config_backend *cfg) ...@@ -361,7 +361,7 @@ static int config_refresh(git_config_backend *cfg)
} }
git_array_clear(b->file.includes); git_array_clear(b->file.includes);
if ((error = config_read(b->repo, values->values, &b->file, b->level, 0)) < 0) if ((error = config_read(values->values, b->repo, &b->file, b->level, 0)) < 0)
goto out; goto out;
if ((error = git_mutex_lock(&b->header.values_mutex)) < 0) { if ((error = git_mutex_lock(&b->header.values_mutex)) < 0) {
...@@ -1601,7 +1601,7 @@ static int parse_include(struct reader *reader, ...@@ -1601,7 +1601,7 @@ static int parse_include(struct reader *reader,
git_array_init(include->includes); git_array_init(include->includes);
include->path = git_buf_detach(&path); include->path = git_buf_detach(&path);
result = config_read(parse_data->repo, parse_data->values, result = config_read(parse_data->values, parse_data->repo,
include, parse_data->level, parse_data->depth+1); include, parse_data->level, parse_data->depth+1);
if (result == GIT_ENOTFOUND) { if (result == GIT_ENOTFOUND) {
...@@ -1766,8 +1766,9 @@ static int read_on_variable( ...@@ -1766,8 +1766,9 @@ static int read_on_variable(
return result; return result;
} }
static int config_read(const git_repository *repo, static int config_read(
git_strmap *values, git_strmap *values,
const git_repository *repo,
struct config_file *file, struct config_file *file,
git_config_level_t level, git_config_level_t level,
int depth) int depth)
......
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