From ca80bc1e62f377e3151521c809b6b41df2b22857 Mon Sep 17 00:00:00 2001 From: borutr Date: Sun, 15 Jun 2003 18:58:47 +0000 Subject: [PATCH] reimplemented function inCalleeSaveList() by using sets instead fixed width array of pointers git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2697 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCsymt.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index 33358807..c085bc09 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -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); } /*-----------------------------------------------------------------*/ -- 2.47.2