Replace comprasions with \0 with boolean ones

This commit is contained in:
Alex 2020-07-15 14:44:08 +02:00
parent 7d95860830
commit 2c543d6d03
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 4 additions and 4 deletions

View File

@ -132,12 +132,12 @@ signed int Tok_mesg(char* str, IRC_Message* out)
}
int i;
for (i = 0; *progr != ':' && i < 14 && *progr != '\0'; i++) {
for (i = 0; *progr != ':' && i < 14 && *progr; i++) {
if ((out->args[i] = strtok_r(NULL, " ", &progr)) == NULL)
return ERR_UIRC_INVALID_FORMAT;
}
out->args[i] = NULL;
if (*progr != '\0')
if (*progr)
out->trailing = (*progr == ':') ? progr + 1 : progr;
return 1;
}
@ -214,7 +214,7 @@ signed int Assm_tags(char* buf, IRC_Tags* in)
if (sprintf(pos++, "+") != 1)
return ERR_UIRC_BUFFER_ERR;
}
cnt = (*(*tagmps[i].assg).value != '\0') ? sprintf(pos, "%s=%s", tagmps[i].name, (*tagmps[i].assg).value) : sprintf(pos, "%s", tagmps[i].name);
cnt = (*(*tagmps[i].assg).value) ? sprintf(pos, "%s=%s", tagmps[i].name, (*tagmps[i].assg).value) : sprintf(pos, "%s", tagmps[i].name);
if (cnt > 0)
pos += cnt;
else
@ -310,7 +310,7 @@ signed int Tok_user(char* str, IRC_User* out, bool useorig)
*(out->orig++) = '\0';
if ((out->user = strchr(pos, '!')) != NULL) /* RFC2812 says this cannot be here without the host but RFC1459 says it can, we accept both options */
*((char*)out->user++) = '\0';
if (*(out->nick = pos) == '\0') /* NOTE: This may be the server instead of a nick according to RFC2812, it is left to the library out to decide how to interpret this based on the context. */
if (!*(out->nick = pos)) /* NOTE: This may be the server instead of a nick according to RFC2812, it is left to the library out to decide how to interpret this based on the context. */
return ERR_UIRC_INVALID_FORMAT;
return 1;
}