introduce LONE_CHAR (optimized strcmp with one-char string)

This commit is contained in:
Denis Vlasenko
2006-12-21 13:23:14 +00:00
parent 6910741067
commit bf66fbc8e2
17 changed files with 49 additions and 35 deletions

View File

@@ -759,7 +759,7 @@ static servtab_t *getconfigent(void)
while (nsep != NULL) {
nsep->se_checked = 1;
if (nsep->se_family == AF_INET) {
if (!strcmp(nsep->se_hostaddr, "*"))
if (LONE_CHAR(nsep->se_hostaddr, '*'))
nsep->se_ctrladdr_in.sin_addr.s_addr = INADDR_ANY;
else if (!inet_aton(nsep->se_hostaddr, &nsep->se_ctrladdr_in.sin_addr)) {
struct hostent *hp;

View File

@@ -678,7 +678,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
if (brd_len) {
duparg("broadcast", *argv);
}
if (strcmp(*argv, "+") == 0) {
if (LONE_CHAR(*argv, '+')) {
brd_len = -1;
}
else if (LONE_DASH(*argv)) {