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
This commit is contained in:
Junio C Hamano
2022-05-20 15:26:59 -07:00
67 changed files with 180 additions and 150 deletions

View File

@ -134,7 +134,7 @@ int search_ref_dir(struct ref_dir *dir, const char *refname, size_t len)
r = bsearch(&key, dir->entries, dir->nr, sizeof(*dir->entries),
ref_entry_cmp_sslice);
if (r == NULL)
if (!r)
return -1;
return r - dir->entries;