From: ceriel Date: Mon, 31 Oct 1988 14:10:39 +0000 (+0000) Subject: inline substitution of strcmp: was called many times! X-Git-Tag: release-5-5~2767 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b5083a9ccf9a4d9a6ff69185cf344ed92490e588;p=ack.git inline substitution of strcmp: was called many times! --- diff --git a/lang/cem/cemcom/idf.c b/lang/cem/cemcom/idf.c index cd595639f..8a48ccf9a 100644 --- a/lang/cem/cemcom/idf.c +++ b/lang/cem/cemcom/idf.c @@ -63,11 +63,18 @@ idf_hashed(tg, size, hc) register struct idf **hook = &idf_hashtable[hc], *notch; while ((notch = *hook)) { - register cmp = strcmp(tg, notch->id_text); + register char *s1 = tg; + register char *cp = notch->id_text; + register int cmp; + + while (!(cmp = (*s1 - *cp++))) { + if (*s1++ == '\0') { + break; + } + } if (cmp < 0) break; - else if (cmp == 0) { /* suppose that special identifiers, as "setjmp", are already inserted @@ -75,8 +82,7 @@ idf_hashed(tg, size, hc) sp_occurred[notch->id_special] = 1; return notch; } - else - hook = ¬ch->next; + hook = ¬ch->next; } /* a new struct idf must be inserted at the hook */ notch = new_idf();