Replace comprasions with \0 with boolean ones
This commit is contained in:
parent
7d95860830
commit
2c543d6d03
|
@ -132,12 +132,12 @@ signed int Tok_mesg(char* str, IRC_Message* out)
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
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)
|
if ((out->args[i] = strtok_r(NULL, " ", &progr)) == NULL)
|
||||||
return ERR_UIRC_INVALID_FORMAT;
|
return ERR_UIRC_INVALID_FORMAT;
|
||||||
}
|
}
|
||||||
out->args[i] = NULL;
|
out->args[i] = NULL;
|
||||||
if (*progr != '\0')
|
if (*progr)
|
||||||
out->trailing = (*progr == ':') ? progr + 1 : progr;
|
out->trailing = (*progr == ':') ? progr + 1 : progr;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ signed int Assm_tags(char* buf, IRC_Tags* in)
|
||||||
if (sprintf(pos++, "+") != 1)
|
if (sprintf(pos++, "+") != 1)
|
||||||
return ERR_UIRC_BUFFER_ERR;
|
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)
|
if (cnt > 0)
|
||||||
pos += cnt;
|
pos += cnt;
|
||||||
else
|
else
|
||||||
|
@ -310,7 +310,7 @@ signed int Tok_user(char* str, IRC_User* out, bool useorig)
|
||||||
*(out->orig++) = '\0';
|
*(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 */
|
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';
|
*((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 ERR_UIRC_INVALID_FORMAT;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue