summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-27 21:33:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-27 21:33:42 (GMT)
commit7ae96e3fcfcd4f3d7c18965eb8805554a9e432bc (patch)
treecd741e42d51387ffcfd7baeaa79e27ba5b45d3ae
parenta988ce9a580bb1cae6fbeead69eff53b113a373c (diff)
parentce528de023f82d767096b0342b6da8039feff7bc (diff)
downloadgit-7ae96e3fcfcd4f3d7c18965eb8805554a9e432bc.zip
git-7ae96e3fcfcd4f3d7c18965eb8805554a9e432bc.tar.gz
git-7ae96e3fcfcd4f3d7c18965eb8805554a9e432bc.tar.bz2
Merge branch 'ab/unconditional-free-and-null'
Code clean-up. * ab/unconditional-free-and-null: refactor various if (x) FREE_AND_NULL(x) to just FREE_AND_NULL(x)
-rw-r--r--blame.c4
-rw-r--r--branch.c4
-rw-r--r--http.c4
-rw-r--r--tree-diff.c4
4 files changed, 4 insertions, 12 deletions
diff --git a/blame.c b/blame.c
index 08c0c6c..aca06f4 100644
--- a/blame.c
+++ b/blame.c
@@ -337,9 +337,7 @@ static void fill_origin_blob(struct diff_options *opt,
static void drop_origin_blob(struct blame_origin *o)
{
- if (o->file.ptr) {
- FREE_AND_NULL(o->file.ptr);
- }
+ FREE_AND_NULL(o->file.ptr);
}
/*
diff --git a/branch.c b/branch.c
index ecd710d..776f55f 100644
--- a/branch.c
+++ b/branch.c
@@ -25,9 +25,7 @@ static int find_tracked_branch(struct remote *remote, void *priv)
tracking->remote = remote->name;
} else {
free(tracking->spec.src);
- if (tracking->src) {
- FREE_AND_NULL(tracking->src);
- }
+ FREE_AND_NULL(tracking->src);
}
tracking->spec.src = NULL;
}
diff --git a/http.c b/http.c
index b4bfbce..4162860 100644
--- a/http.c
+++ b/http.c
@@ -2418,9 +2418,7 @@ void release_http_object_request(struct http_object_request *freq)
close(freq->localfile);
freq->localfile = -1;
}
- if (freq->url != NULL) {
- FREE_AND_NULL(freq->url);
- }
+ FREE_AND_NULL(freq->url);
if (freq->slot != NULL) {
freq->slot->callback_func = NULL;
freq->slot->callback_data = NULL;
diff --git a/tree-diff.c b/tree-diff.c
index fe2e466..553bc0e 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -557,9 +557,7 @@ struct combine_diff_path *diff_tree_paths(
* free pre-allocated last element, if any
* (see path_appendnew() for details about why)
*/
- if (p->next) {
- FREE_AND_NULL(p->next);
- }
+ FREE_AND_NULL(p->next);
return p;
}