diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-10-05 13:48:20 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-05 13:48:20 +0900 |
commit | e3c677fdc478d1ca023551160beab8cf377627c0 (patch) | |
tree | 6e547c5249c548a72dc7d5c2653a011ba0ce9cc3 | |
parent | 1d4a1f6452dee50576e1511e07d208da418b2c6b (diff) | |
parent | 90dd04aaeb9ddbdc26c5937a118db505c6a28394 (diff) | |
download | git-e3c677fdc478d1ca023551160beab8cf377627c0.tar.gz |
Merge branch 'rs/use-free-and-null'
Code clean-up.
* rs/use-free-and-null:
repository: use FREE_AND_NULL
-rw-r--r-- | repository.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/repository.c b/repository.c index 97c732bd48..bb2fae5446 100644 --- a/repository.c +++ b/repository.c @@ -200,25 +200,17 @@ out: void repo_clear(struct repository *repo) { - free(repo->gitdir); - repo->gitdir = NULL; - free(repo->commondir); - repo->commondir = NULL; - free(repo->objectdir); - repo->objectdir = NULL; - free(repo->graft_file); - repo->graft_file = NULL; - free(repo->index_file); - repo->index_file = NULL; - free(repo->worktree); - repo->worktree = NULL; - free(repo->submodule_prefix); - repo->submodule_prefix = NULL; + FREE_AND_NULL(repo->gitdir); + FREE_AND_NULL(repo->commondir); + FREE_AND_NULL(repo->objectdir); + FREE_AND_NULL(repo->graft_file); + FREE_AND_NULL(repo->index_file); + FREE_AND_NULL(repo->worktree); + FREE_AND_NULL(repo->submodule_prefix); if (repo->config) { git_configset_clear(repo->config); - free(repo->config); - repo->config = NULL; + FREE_AND_NULL(repo->config); } if (repo->submodule_cache) { @@ -228,8 +220,7 @@ void repo_clear(struct repository *repo) if (repo->index) { discard_index(repo->index); - free(repo->index); - repo->index = NULL; + FREE_AND_NULL(repo->index); } } |