From c3cac7a521857747771f661d607004f58470e0cc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 3 Apr 2021 10:31:02 +0200 Subject: Use strcmpnul MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- set-contact-pgpkeys.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'set-contact-pgpkeys.c') diff --git a/set-contact-pgpkeys.c b/set-contact-pgpkeys.c index b5bebfb..adb62d3 100644 --- a/set-contact-pgpkeys.c +++ b/set-contact-pgpkeys.c @@ -53,7 +53,7 @@ main(int argc, char *argv[]) for (; contact.pgpkeys[i]; i++); } else if (update_id) { for (; contact.pgpkeys[i]; i++) { - if (contact.pgpkeys[i]->context && !strcmp(contact.pgpkeys[i]->context, argv[1])) { + if (!strcmpnul(contact.pgpkeys[i]->context, argv[1])) { free(contact.pgpkeys[i]->id); contact.pgpkeys[i]->id = estrdup(argv[2]); goto save; @@ -61,7 +61,7 @@ main(int argc, char *argv[]) } } else if (update_context) { for (; contact.pgpkeys[i]; i++) { - if (contact.pgpkeys[i]->id && !strcmp(contact.pgpkeys[i]->id, argv[2])) { + if (!strcmpnul(contact.pgpkeys[i]->id, argv[2])) { free(contact.pgpkeys[i]->context); contact.pgpkeys[i]->context = estrdup(argv[1]); goto save; @@ -69,16 +69,16 @@ main(int argc, char *argv[]) } } else if (argc == 3) { for (; contact.pgpkeys[i]; i++) - if (contact.pgpkeys[i]->context && !strcmp(contact.pgpkeys[i]->context, argv[1])) - if (contact.pgpkeys[i]->id && !strcmp(contact.pgpkeys[i]->id, argv[2])) + if (!strcmpnul(contact.pgpkeys[i]->context, argv[1])) + if (!strcmpnul(contact.pgpkeys[i]->id, argv[2])) break; } else if (remove_by_context) { for (; contact.pgpkeys[i]; i++) - if (contact.pgpkeys[i]->context && !strcmp(contact.pgpkeys[i]->context, argv[1])) + if (!strcmpnul(contact.pgpkeys[i]->context, argv[1])) break; } else { for (; contact.pgpkeys[i]; i++) - if (contact.pgpkeys[i]->id && !strcmp(contact.pgpkeys[i]->id, argv[1])) + if (!strcmpnul(contact.pgpkeys[i]->id, argv[1])) break; } } -- cgit v1.2.3-70-g09d2