intrin.c (upcasecmp_): New function.
authorToon Moene <toon@moene.indiv.nluug.nl>
Wed, 30 Jan 2002 22:59:47 +0000 (23:59 +0100)
committerToon Moene <toon@gcc.gnu.org>
Wed, 30 Jan 2002 22:59:47 +0000 (22:59 +0000)
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

gcc/f/ChangeLog
gcc/f/intrin.c

index bccdcaebbbd97a104012f12ca9072bc1d5da7547..fb1e75b701853e460ca4a92ae4959606147d06a7 100644 (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
index 9759ab70a361a10d39a4db50793b36cf2e272f20..83a478c706575d6183e583f313c3027d30044335 100644 (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 ())
        {