Merge pull request #235 from dequis/g_strcmp0

Change all strcmp() to g_strcmp0() to handle nulls gracefully
This commit is contained in:
Alexander Færøy 2015-04-17 21:13:18 +02:00
commit 03be2861dc
58 changed files with 174 additions and 170 deletions

View file

@ -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 -<chatnet> option is used to specify chat protocol */
@ -287,7 +287,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);
@ -347,7 +347,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') {
@ -359,7 +359,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);