Strcmp optimized strcmp by unrolling the first iteration of a byte comparison
loop. This is no longer an optimization. In modern compilers/libc, (1) strcmp is
generally no longer a byte-by-byte comparison loop and (2) the compiler knows
strcmp as a built-in and can do this kind of unrolling itself. As a result, the
compiler actually has to do *more* work to reverse Strcmp back into strcmp and
thus determine it can use, e.g., SIMD optimizations.
This is essentially the next step of
f5a326cb061866bb3beaa33c3e5169efe7fc134d.
}
t1 = Tgettype(v1o), t2 = Tgettype(v2o);
if (t1 == T_STRING && t2 == T_STRING) {
- r = Strcmp(Tgetstring(v1o), Tgetstring(v2o));
+ r = strcmp(Tgetstring(v1o), Tgetstring(v2o));
} else if (t1 == T_INTEGER && t2 == T_INTEGER) {
i1 = Tgetinteger(v1o), i2 = Tgetinteger(v2o);
r = (i1 == i2) ? 0 : ((i1 < i2) ? -1 : 1);
#define ISEQRK(rk, ko) \
(T_ISNUMBER (ko) && Tgetnumber (ko) == (rk))
#define ISEQSK(sk, ko) \
- (T_ISSTRING (ko) && Strcmp (((Tstring_t *) (ko))->s, (sk)) == 0)
+ (T_ISSTRING (ko) && strcmp (((Tstring_t *) (ko))->s, (sk)) == 0)
#define GETIKINDEX(tp, ik) (unsigned long) ik % tp->ln
#define GETRKINDEX(tp, rk) (unsigned long) rk % tp->ln
case G_ATTRBORDERWIDTH:
break;
case G_ATTRMODE:
- if (Strcmp("horizontal", attrp[ai].u.t) == 0) {
+ if (strcmp("horizontal", attrp[ai].u.t) == 0) {
WAU->mode = G_AWHARRAY;
- } else if (Strcmp("vertical", attrp[ai].u.t) == 0) {
+ } else if (strcmp("vertical", attrp[ai].u.t) == 0) {
WAU->mode = G_AWVARRAY;
} else {
Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
}
break;
case G_ATTRLAYOUT:
- if (Strcmp("on", attrp[ai].u.t) == 0)
+ if (strcmp("on", attrp[ai].u.t) == 0)
Gawsetmode(widget, FALSE);
- else if (Strcmp("off", attrp[ai].u.t) == 0)
+ else if (strcmp("off", attrp[ai].u.t) == 0)
Gawsetmode(widget, TRUE);
else {
Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
Gerr(POS, G_ERRCANNOTSETATTR2, "mode");
return -1;
case G_ATTRLAYOUT:
- if (Strcmp("on", attrp[ai].u.t) == 0)
+ if (strcmp("on", attrp[ai].u.t) == 0)
Gawsetmode(widget, FALSE);
- else if (Strcmp("off", attrp[ai].u.t) == 0)
+ else if (strcmp("off", attrp[ai].u.t) == 0)
Gawsetmode(widget, TRUE);
else {
Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
break;
#ifdef FEATURE_GMAP
case G_ATTRMODE:
- if (Strcmp("gmap", attrp[ai].u.t) == 0) {
+ if (strcmp("gmap", attrp[ai].u.t) == 0) {
gmapmode = TRUE;
} else {
Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
for (ai = 0; ai < attrn; ai++) {
switch (attrp[ai].id) {
case G_ATTRCURSOR:
- if (Strcmp(attrp[ai].u.t, "default") == 0) {
+ if (strcmp(attrp[ai].u.t, "default") == 0) {
curcursori = -1;
}
break;
case G_ATTRBORDERWIDTH:
break;
case G_ATTRCURSOR:
- if (Strcmp(attrp[ai].u.t, "watch") == 0) {
+ if (strcmp(attrp[ai].u.t, "watch") == 0) {
gdk_window_set_cursor(widget->w->window,
gdk_cursor_new(GDK_WATCH));
} else {
sprintf(&Gbufp[0], name, size);
for (fi = 0; fi < Gfontn; fi++)
- if (Strcmp(&Gbufp[0], Gfontp[fi].name) == 0)
+ if (strcmp(&Gbufp[0], Gfontp[fi].name) == 0)
return Gfontp[fi].font;
if (!(font = gdk_font_load(&Gbufp[0]))) {
for (ai = 0; ai < attrn; ai++) {
switch (attrp[ai].id) {
case G_ATTRMODE:
- if (Strcmp("string", attrp[ai].u.t) == 0)
+ if (strcmp("string", attrp[ai].u.t) == 0)
WQU->mode = G_QWSTRING;
- else if (Strcmp("file", attrp[ai].u.t) == 0)
+ else if (strcmp("file", attrp[ai].u.t) == 0)
WQU->mode = G_QWFILE;
- else if (Strcmp("choice", attrp[ai].u.t) == 0)
+ else if (strcmp("choice", attrp[ai].u.t) == 0)
WQU->mode = G_QWCHOICE;
else {
Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);