From f14199d9c15a8062b5663fa6fcdae00390473b15 Mon Sep 17 00:00:00 2001 From: dequis Date: Tue, 7 Apr 2015 22:39:05 -0300 Subject: 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 --- src/core/chat-commands.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/chat-commands.c') diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index 8d1ac3eb..c1d874e3 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -58,7 +58,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, return NULL; } - if (strcmp(password, "-") == 0) + if (g_strcmp0(password, "-") == 0) *password = '\0'; /* check if - option is used to specify chat protocol */ @@ -283,7 +283,7 @@ static void cmd_disconnect(const char *data, SERVER_REC *server) if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg)) return; - if (*tag != '\0' && strcmp(tag, "*") != 0) { + if (*tag != '\0' && g_strcmp0(tag, "*") != 0) { server = server_find_tag(tag); if (server == NULL) server = server_find_lookup_tag(tag); @@ -343,7 +343,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) origtarget = target; free_ret = FALSE; - if (strcmp(target, ",") == 0 || strcmp(target, ".") == 0) { + if (g_strcmp0(target, ",") == 0 || g_strcmp0(target, ".") == 0) { target = parse_special(&target, server, item, NULL, &free_ret, NULL, 0); if (target != NULL && *target == '\0') { @@ -355,7 +355,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) } if (target != NULL) { - if (strcmp(target, "*") == 0) { + if (g_strcmp0(target, "*") == 0) { /* send to active channel/query */ if (item == NULL) cmd_param_error(CMDERR_NOT_JOINED); -- cgit v1.2.3