+2002-01-30 Toon Moene <toon@moene.indiv.nluug.nl>
+
+ * intrin.c (upcasecmp_): New function.
+ (ffeintrin_cmp_name_): Use it to correctly compare name
+ and table entry for bsearch.
+
2002-01-26 Toon Moene <toon@moene.indiv.nluug.nl>
* intrin.c (ffeintrin_cmp_name_): Correct comparison
return FALSE;
}
-/* Compare name to intrinsic's name. Uses strcmp on arguments' names.
+/* Compare a forced-to-uppercase name with a known-upper-case name. */
+
+static int
+upcasecmp_ (const char *name, const char *ucname)
+{
+ for ( ; *name != 0 && *ucname != 0; name++, ucname++)
+ {
+ int i = TOUPPER(*name) - *ucname;
+
+ if (i != 0)
+ return i;
+ }
+
+ return *name - *ucname;
+}
+
+/* Compare name to intrinsic's name.
The intrinsics table is sorted on the upper case entries; so first
compare irrespective of case on the `uc' entry. If it matches,
compare according to the setting of intrinsics case comparison mode. */
const char *const ic = ((const struct _ffeintrin_name_ *) intrinsic)->name_ic;
int i;
- if ((i = strcasecmp (name, uc)) == 0)
+ if ((i = upcasecmp_ (name, uc)) == 0)
{
switch (ffe_case_intrin ())
{