summaryrefslogtreecommitdiff
path: root/tree-diff.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-08-17 13:02:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-17 17:08:56 (GMT)
commitce528de023f82d767096b0342b6da8039feff7bc (patch)
tree53e85fcee37cfd8b2611c47915c3acbb53143d00 /tree-diff.c
parent53f9a3e157dbbc901a02ac2c73346d375e24978c (diff)
downloadgit-ce528de023f82d767096b0342b6da8039feff7bc.zip
git-ce528de023f82d767096b0342b6da8039feff7bc.tar.gz
git-ce528de023f82d767096b0342b6da8039feff7bc.tar.bz2
refactor various if (x) FREE_AND_NULL(x) to just FREE_AND_NULL(x)
Change the few conditional uses of FREE_AND_NULL(x) to be unconditional. As noted in the standard[1] free(NULL) is perfectly valid, so we might as well leave this check up to the C library. 1. http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-diff.c')
-rw-r--r--tree-diff.c4
1 files changed, 1 insertions, 3 deletions
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;
}