intrin.c (upcasecmp_): New function.

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.

From-SVN: r49347
This commit is contained in:
Toon Moene 2002-01-30 23:59:47 +01:00 committed by Toon Moene
parent 86f808dc81
commit 41ff8055c5
2 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -1153,7 +1153,23 @@ ffeintrin_check_any_ (ffebld arglist)
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. */
@ -1166,7 +1182,7 @@ ffeintrin_cmp_name_ (const void *name, const void *intrinsic)
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 ())
{