Commit b1914c36 by Russell Belfer

Minor fixes for warnings and error propagation

parent 7bcced44
...@@ -418,7 +418,11 @@ GIT_EXTERN(int) git_repository_config(git_config **out, git_repository *repo); ...@@ -418,7 +418,11 @@ GIT_EXTERN(int) git_repository_config(git_config **out, git_repository *repo);
* Get a snapshot of the repository's configuration * Get a snapshot of the repository's configuration
* *
* Convenience function to take a snapshot from the repository's * Convenience function to take a snapshot from the repository's
* configuration. * configuration. The contents of this snapshot will not change,
* even if the underlying config files are modified.
*
* The configuration file must be freed once it's no longer
* being used by the user.
* *
* @param out Pointer to store the loaded configuration * @param out Pointer to store the loaded configuration
* @param repo the repository * @param repo the repository
......
...@@ -247,18 +247,15 @@ static int refcounted_strmap_alloc(refcounted_strmap **out) ...@@ -247,18 +247,15 @@ static int refcounted_strmap_alloc(refcounted_strmap **out)
int error; int error;
map = git__calloc(1, sizeof(refcounted_strmap)); map = git__calloc(1, sizeof(refcounted_strmap));
if (!map) { GITERR_CHECK_ALLOC(map);
giterr_set_oom();
return -1;
}
git_atomic_set(&map->refcount, 1); git_atomic_set(&map->refcount, 1);
if ((error = git_strmap_alloc(&map->values)) < 0) {
if ((error = git_strmap_alloc(&map->values)) < 0)
git__free(map); git__free(map);
return error; else
} *out = map;
*out = map;
return error; return error;
} }
......
...@@ -219,7 +219,7 @@ static int git_diff_driver_load( ...@@ -219,7 +219,7 @@ static int git_diff_driver_load(
git_diff_driver *drv = NULL; git_diff_driver *drv = NULL;
size_t namelen = strlen(driver_name); size_t namelen = strlen(driver_name);
khiter_t pos; khiter_t pos;
git_config *cfg, *repo_cfg; git_config *cfg;
git_buf name = GIT_BUF_INIT; git_buf name = GIT_BUF_INIT;
const git_config_entry *ce; const git_config_entry *ce;
bool found_driver = false; bool found_driver = false;
......
...@@ -627,10 +627,11 @@ int git_repository_config(git_config **out, git_repository *repo) ...@@ -627,10 +627,11 @@ int git_repository_config(git_config **out, git_repository *repo)
int git_repository_config_snapshot(git_config **out, git_repository *repo) int git_repository_config_snapshot(git_config **out, git_repository *repo)
{ {
int error;
git_config *weak; git_config *weak;
if (git_repository_config__weakptr(&weak, repo) < 0) if ((error = git_repository_config__weakptr(&weak, repo)) < 0)
return -1; return error;
return git_config_snapshot(out, weak); return git_config_snapshot(out, weak);
} }
......
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