diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-05-21 01:26:59 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-21 01:26:59 +0300 |
commit | 538dc459a0331c48b893c9f6ca0be5917860bb99 (patch) | |
tree | d8b7cf10c62573f767116c14f7ffd0d9e1d8ec32 /merge-recursive.c | |
parent | acdeb10f91da939135fbacb847792ae237450d7d (diff) | |
parent | 72a4ea71e5f29e4078363e87e4471128ff713a62 (diff) |
Merge branch 'ep/maint-equals-null-cocci'
Introduce and apply coccinelle rule to discourage an explicit
comparison between a pointer and NULL, and applies the clean-up to
the maintenance track.
* ep/maint-equals-null-cocci:
tree-wide: apply equals-null.cocci
tree-wide: apply equals-null.cocci
contrib/coccinnelle: add equals-null.cocci
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 1ee6364e8b..fd1bbde061 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -82,7 +82,7 @@ static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap, { struct dir_rename_entry key; - if (dir == NULL) + if (!dir) return NULL; hashmap_entry_init(&key.ent, strhash(dir)); key.dir = dir; @@ -1990,14 +1990,14 @@ static void get_renamed_dir_portion(const char *old_path, const char *new_path, * renamed means the root directory can never be renamed -- because * the root directory always exists). */ - if (end_of_old == NULL) + if (!end_of_old) return; /* Note: *old_dir and *new_dir are still NULL */ /* * If new_path contains no directory (end_of_new is NULL), then we * have a rename of old_path's directory to the root directory. */ - if (end_of_new == NULL) { + if (!end_of_new) { *old_dir = xstrndup(old_path, end_of_old - old_path); *new_dir = xstrdup(""); return; @@ -2116,7 +2116,7 @@ static char *handle_path_level_conflicts(struct merge_options *opt, * to ensure that's the case. */ collision_ent = collision_find_entry(collisions, new_path); - if (collision_ent == NULL) + if (!collision_ent) BUG("collision_ent is NULL"); /* @@ -2996,7 +2996,7 @@ static void final_cleanup_rename(struct string_list *rename) const struct rename *re; int i; - if (rename == NULL) + if (!rename) return; for (i = 0; i < rename->nr; i++) { @@ -3605,7 +3605,7 @@ static int merge_recursive_internal(struct merge_options *opt, } merged_merge_bases = pop_commit(&merge_bases); - if (merged_merge_bases == NULL) { + if (!merged_merge_bases) { /* if there is no common ancestor, use an empty tree */ struct tree *tree; |