summaryrefslogtreecommitdiff
path: root/mailmap.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-05-20 22:26:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-05-20 22:26:59 (GMT)
commit538dc459a0331c48b893c9f6ca0be5917860bb99 (patch)
treed8b7cf10c62573f767116c14f7ffd0d9e1d8ec32 /mailmap.c
parentacdeb10f91da939135fbacb847792ae237450d7d (diff)
parent72a4ea71e5f29e4078363e87e4471128ff713a62 (diff)
downloadgit-538dc459a0331c48b893c9f6ca0be5917860bb99.zip
git-538dc459a0331c48b893c9f6ca0be5917860bb99.tar.gz
git-538dc459a0331c48b893c9f6ca0be5917860bb99.tar.bz2
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 'mailmap.c')
-rw-r--r--mailmap.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mailmap.c b/mailmap.c
index 7befdc5..da2589b 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -77,7 +77,7 @@ static void add_mapping(struct string_list *map,
struct mailmap_entry *me;
struct string_list_item *item;
- if (old_email == NULL) {
+ if (!old_email) {
old_email = new_email;
new_email = NULL;
}
@@ -92,7 +92,7 @@ static void add_mapping(struct string_list *map,
item->util = me;
}
- if (old_name == NULL) {
+ if (!old_name) {
debug_mm("mailmap: adding (simple) entry for '%s'\n", old_email);
/* Replace current name and new email for simple entry */
@@ -123,9 +123,9 @@ static char *parse_name_and_email(char *buffer, char **name,
char *left, *right, *nstart, *nend;
*name = *email = NULL;
- if ((left = strchr(buffer, '<')) == NULL)
+ if (!(left = strchr(buffer, '<')))
return NULL;
- if ((right = strchr(left+1, '>')) == NULL)
+ if (!(right = strchr(left + 1, '>')))
return NULL;
if (!allow_empty_email && (left+1 == right))
return NULL;
@@ -153,7 +153,7 @@ static void read_mailmap_line(struct string_list *map, char *buffer)
if (buffer[0] == '#')
return;
- if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)
+ if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)))
parse_name_and_email(name2, &name2, &email2, 1);
if (email1)
@@ -320,7 +320,7 @@ int map_user(struct string_list *map,
(int)*emaillen, debug_str(*email));
item = lookup_prefix(map, *email, *emaillen);
- if (item != NULL) {
+ if (item) {
me = (struct mailmap_entry *)item->util;
if (me->namemap.nr) {
/*
@@ -334,7 +334,7 @@ int map_user(struct string_list *map,
item = subitem;
}
}
- if (item != NULL) {
+ if (item) {
struct mailmap_info *mi = (struct mailmap_info *)item->util;
if (mi->name == NULL && mi->email == NULL) {
debug_mm("map_user: -- (no simple mapping)\n");