aboutsummaryrefslogtreecommitdiffstats
path: root/set-contact-emails.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-03 10:31:02 +0200
committerMattias Andrée <maandree@kth.se>2021-04-03 10:31:02 +0200
commitc3cac7a521857747771f661d607004f58470e0cc (patch)
tree91a9058a1000a121a7c89dd7869c866b4d63ca80 /set-contact-emails.c
parentFirst commmit (diff)
downloadcontacts-c3cac7a521857747771f661d607004f58470e0cc.tar.gz
contacts-c3cac7a521857747771f661d607004f58470e0cc.tar.bz2
contacts-c3cac7a521857747771f661d607004f58470e0cc.tar.xz
Use strcmpnul
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'set-contact-emails.c')
-rw-r--r--set-contact-emails.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/set-contact-emails.c b/set-contact-emails.c
index 5911484..d015533 100644
--- a/set-contact-emails.c
+++ b/set-contact-emails.c
@@ -53,7 +53,7 @@ main(int argc, char *argv[])
for (; contact.emails[i]; i++);
} else if (update_address) {
for (; contact.emails[i]; i++) {
- if (contact.emails[i]->context && !strcmp(contact.emails[i]->context, argv[1])) {
+ if (!strcmpnul(contact.emails[i]->context, argv[1])) {
free(contact.emails[i]->address);
contact.emails[i]->address = estrdup(argv[2]);
goto save;
@@ -61,7 +61,7 @@ main(int argc, char *argv[])
}
} else if (update_context) {
for (; contact.emails[i]; i++) {
- if (contact.emails[i]->address && !strcmp(contact.emails[i]->address, argv[2])) {
+ if (!strcmpnul(contact.emails[i]->address, argv[2])) {
free(contact.emails[i]->context);
contact.emails[i]->context = estrdup(argv[1]);
goto save;
@@ -69,16 +69,16 @@ main(int argc, char *argv[])
}
} else if (argc == 3) {
for (; contact.emails[i]; i++)
- if (contact.emails[i]->context && !strcmp(contact.emails[i]->context, argv[1]))
- if (contact.emails[i]->address && !strcmp(contact.emails[i]->address, argv[2]))
+ if (!strcmpnul(contact.emails[i]->context, argv[1]))
+ if (!strcmpnul(contact.emails[i]->address, argv[2]))
break;
} else if (remove_by_context) {
for (; contact.emails[i]; i++)
- if (contact.emails[i]->context && !strcmp(contact.emails[i]->context, argv[1]))
+ if (!strcmpnul(contact.emails[i]->context, argv[1]))
break;
} else {
for (; contact.emails[i]; i++)
- if (contact.emails[i]->address && !strcmp(contact.emails[i]->address, argv[1]))
+ if (!strcmpnul(contact.emails[i]->address, argv[1]))
break;
}
}