diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2017-06-15 23:15:46 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-16 12:44:03 -0700 |
commit | 6a83d902073803c4141e02c53decf8c03e35da27 (patch) | |
tree | 209cf1639a325875240fce3e1f1cabbdb25878df /dir.c | |
parent | cf9f49ea4817b36e93e64909a918a912cc32c28b (diff) | |
download | git-6a83d902073803c4141e02c53decf8c03e35da27.tar.gz |
coccinelle: make use of the "type" FREE_AND_NULL() rule
Apply the result of the just-added coccinelle rule. This manually
excludes a few occurrences, mostly things that resulted in many
FREE_AND_NULL() on one line, that'll be manually fixed in a subsequent
change.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -2117,8 +2117,7 @@ int read_directory(struct dir_struct *dir, struct index_state *istate, for (i = j = 0; j < dir->nr; j++) { if (i && check_dir_entry_contains(dir->entries[i - 1], dir->entries[j])) { - free(dir->entries[j]); - dir->entries[j] = NULL; + FREE_AND_NULL(dir->entries[j]); } else { dir->entries[i++] = dir->entries[j]; } @@ -2144,8 +2143,7 @@ int read_directory(struct dir_struct *dir, struct index_state *istate, dir->untracked->dir_invalidated)) istate->cache_changed |= UNTRACKED_CHANGED; if (dir->untracked != istate->untracked) { - free(dir->untracked); - dir->untracked = NULL; + FREE_AND_NULL(dir->untracked); } } return dir->nr; @@ -2488,8 +2486,7 @@ void write_untracked_extension(struct strbuf *out, struct untracked_cache *untra strbuf_addbuf(out, &untracked->ident); strbuf_add(out, ouc, ouc_size(len)); - free(ouc); - ouc = NULL; + FREE_AND_NULL(ouc); if (!untracked->root) { varint_len = encode_varint(0, varbuf); |