diff options
author | dequis <dx@dxzone.com.ar> | 2015-04-07 22:39:05 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-04-07 22:41:05 -0300 |
commit | f14199d9c15a8062b5663fa6fcdae00390473b15 (patch) | |
tree | 730f9fdb49b2e1f26dd56422f83e6b6ab9867d8a /src/fe-common/irc | |
parent | 9ffe52ec5e3f0643e7ddd12f4d21c0788d2f8cea (diff) | |
download | irssi-f14199d9c15a8062b5663fa6fcdae00390473b15.zip |
Change all strcmp() to g_strcmp0() to handle nulls gracefully
Just a string replacement (but i did check every one of them)
sed -i 's/strcmp(/g_strcmp0(/g' **/*.c
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r-- | src/fe-common/irc/dcc/fe-dcc-chat.c | 2 | ||||
-rw-r--r-- | src/fe-common/irc/fe-events-numeric.c | 4 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-commands.c | 8 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-messages.c | 2 | ||||
-rw-r--r-- | src/fe-common/irc/fe-modes.c | 2 | ||||
-rw-r--r-- | src/fe-common/irc/fe-whois.c | 6 |
6 files changed, 12 insertions, 12 deletions
diff --git a/src/fe-common/irc/dcc/fe-dcc-chat.c b/src/fe-common/irc/dcc/fe-dcc-chat.c index 101aeb31..e2706ba3 100644 --- a/src/fe-common/irc/dcc/fe-dcc-chat.c +++ b/src/fe-common/irc/dcc/fe-dcc-chat.c @@ -243,7 +243,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) return; /* handle only DCC messages */ - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) dcc = item_get_dcc(item); else if (*target == '=') dcc = dcc_chat_find_id(target+1); diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index d6c02d9f..ec7669ab 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -427,7 +427,7 @@ static void event_no_such_nick(IRC_SERVER_REC *server, const char *data, g_return_if_fail(data != NULL); params = event_get_params(data, 2, NULL, &unick); - if (!strcmp(unick, "*")) + if (!g_strcmp0(unick, "*")) /* more information will be in the description, * e.g. * :Target left IRC. Failed to deliver: [hi] */ print_event_received(server, data, nick, FALSE); @@ -605,7 +605,7 @@ static void print_event_received(IRC_SERVER_REC *server, const char *data, recoded = recode_in(SERVER(server), args, NULL); format = nick == NULL || server->real_address == NULL || - strcmp(nick, server->real_address) == 0 ? + g_strcmp0(nick, server->real_address) == 0 ? IRCTXT_DEFAULT_EVENT : IRCTXT_DEFAULT_EVENT_SERVER; printformat(server, target, MSGLEVEL_CRAP, format, nick, recoded, current_server_event); diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index b380c214..a23facbd 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -110,7 +110,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &msg)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? "" : window_item_get_target(item); if (*target == '\0' || *msg == '\0') @@ -133,7 +133,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST, &target, &ctcpcmd, &ctcpdata)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? "" : window_item_get_target(item); if (*target == '\0' || *ctcpcmd == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -162,7 +162,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &text)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? "" : window_item_get_target(item); if (*target == '\0' || *text == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -262,7 +262,7 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server, if (chanrec == NULL && *channel == '\0') cmd_param_error(CMDERR_NOT_JOINED); - if (*channel != '\0' && strcmp(channel, "*") != 0) + if (*channel != '\0' && g_strcmp0(channel, "*") != 0) chanrec = irc_channel_find(server, channel); if (chanrec == NULL || !chanrec->synced) { diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index 314f4f53..94d1ad4a 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -178,7 +178,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, if (ischannel(*target)) { item = irc_channel_find(server, target); } else { - own = (!strcmp(nick, server->nick)); + own = (!g_strcmp0(nick, server->nick)); item = privmsg_get_query(SERVER(server), own ? target : nick, FALSE, level); } diff --git a/src/fe-common/irc/fe-modes.c b/src/fe-common/irc/fe-modes.c index 027d7a76..e5317c0f 100644 --- a/src/fe-common/irc/fe-modes.c +++ b/src/fe-common/irc/fe-modes.c @@ -135,7 +135,7 @@ static void msg_multi_mode(IRC_CHANNEL_REC *channel, const char *sender, signal_add("print starting", (SIGNAL_FUNC) sig_print_starting); rec = mode_find_channel(channel); - if (rec != NULL && strcmp(rec->mode, mode) != 0) { + if (rec != NULL && g_strcmp0(rec->mode, mode) != 0) { /* different mode than last time, show and remove the old */ print_mode(rec); mode_destroy(rec); diff --git a/src/fe-common/irc/fe-whois.c b/src/fe-common/irc/fe-whois.c index a9c3775e..117df120 100644 --- a/src/fe-common/irc/fe-whois.c +++ b/src/fe-common/irc/fe-whois.c @@ -134,8 +134,8 @@ static void event_whois_realhost(IRC_SERVER_REC *server, const char *data) /* <yournick> real hostname <nick> <hostname> */ params = event_get_params(data, 5, NULL, &nick, &txt_real, &txt_hostname, &hostname); - if (strcmp(txt_real, "real") != 0 || - strcmp(txt_hostname, "hostname") != 0) { + if (g_strcmp0(txt_real, "real") != 0 || + g_strcmp0(txt_hostname, "hostname") != 0) { /* <yournick> <nick> :... from <hostname> */ g_free(params); params = event_get_params(data, 3, NULL, &nick, &hostname); @@ -219,7 +219,7 @@ static void event_whois_usermode(IRC_SERVER_REC *server, const char *data) params = event_get_params(data, 4, NULL, &txt_usermodes, &nick, &usermode); - if (strcmp(txt_usermodes, "usermodes") == 0) { + if (g_strcmp0(txt_usermodes, "usermodes") == 0) { /* <yournick> usermodes <nick> usermode */ printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_USERMODE, nick, usermode); |