hirc

IRC client
Log | Files | Refs

commit 97b70012e75cb7c6d396bdb0e44b3ab5f275265c
parent cbca1d9d32f4c861c3d596fb6489491f2c8a5fd8
Author: hhvn <dev@hhvn.uk>
Date:   Sun, 27 Mar 2022 11:41:41 +0100

Use strcmp_n in more places where a string could be NULL

Diffstat:
Msrc/handle.c | 4++--
Msrc/nick.c | 4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/handle.c b/src/handle.c @@ -274,7 +274,7 @@ handle_PRIVMSG) { if (strchr(nick->nick, '.')) { /* it's a server */ hist_addp(server->history, msg, Activity_status, HIST_DFL); - } else if (strcmp(target, server->self->nick) == 0) { + } else if (strcmp_n(target, server->self->nick) == 0) { /* it's messaging me */ if ((priv = chan_get(&server->privs, nick->nick, -1)) == NULL) priv = chan_add(server, &server->privs, nick->nick, 1); @@ -497,7 +497,7 @@ handle_NICK) { hist_addp(server->history, msg, Activity_status, HIST_DFL); newnick = *(msg->params+1); - if (strcmp(nick->nick, newnick) == 0) + if (strcmp_n(nick->nick, newnick) == 0) return; if (nick_isself(nick)) { diff --git a/src/nick.c b/src/nick.c @@ -154,7 +154,7 @@ nick_isself_server(struct Nick *nick, struct Server *server) { if (!nick || !server || !nick->nick) return 0; - if (strcmp(server->self->nick, nick->nick) == 0) + if (strcmp_n(server->self->nick, nick->nick) == 0) return 1; else return 0; @@ -190,7 +190,7 @@ nick_get(struct Nick **head, char *nick) { p = *head; for (; p; p = p->next) { - if (strcmp(p->nick, nick) == 0) + if (strcmp_n(p->nick, nick) == 0) return p; }