reimplemented function inCalleeSaveList() by using sets instead fixed width array...
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 15 Jun 2003 18:58:47 +0000 (18:58 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 15 Jun 2003 18:58:47 +0000 (18:58 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2697 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCsymt.c

index 33358807f1803c51005dfd153ee4c2590de79979..c085bc09f2766a2cd5e15c16c2ac64ca71dbbe55 100644 (file)
@@ -1530,17 +1530,18 @@ compareType (sym_link * dest, sym_link * src)
 /*------------------------------------------------------------------*/
 /* inCalleeSaveList - return 1 if found in callee save list          */
 /*------------------------------------------------------------------*/
-bool 
-inCalleeSaveList (char *s)
+static int
+calleeCmp(void *p1, void *p2)
 {
-  int i;
-
-  if (options.all_callee_saves) return 1;
-  for (i = 0; options.calleeSaves[i]; i++)
-    if (strcmp (options.calleeSaves[i], s) == 0)
-      return 1;
+  return (strcmp((char *)p1, (char *)(p2)) == 0);
+}
 
-  return 0;
+bool
+inCalleeSaveList(char *s)
+{
+  if (options.all_callee_saves)
+    return 1;
+  return isinSetWith(options.calleeSavesSet, s, calleeCmp);
 }
 
 /*-----------------------------------------------------------------*/