From: cuz Date: Mon, 28 Apr 2003 21:54:06 +0000 (+0000) Subject: Working X-Git-Tag: V2.12.0~1612 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=09629cd2291f051e82c79965d6d01a0a11094ecb;p=cc65 Working git-svn-id: svn://svn.cc65.org/cc65/trunk@2100 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/sim65/cfgdata.c b/src/sim65/cfgdata.c index cd824292f..f603c8e28 100644 --- a/src/sim65/cfgdata.c +++ b/src/sim65/cfgdata.c @@ -87,7 +87,7 @@ void FreeCfgData (CfgData* D) -int CfgDataFind (Collection* Attributes, const char* AttrName) +int CfgDataFind (const Collection* Attributes, const char* AttrName) /* Find the attribute with the given name and return its index. Return -1 if * the attribute was not found. */ @@ -108,7 +108,7 @@ int CfgDataFind (Collection* Attributes, const char* AttrName) } /* Not found */ - return -1; + return -1; } diff --git a/src/sim65/cfgdata.h b/src/sim65/cfgdata.h index 655145585..b31234e64 100644 --- a/src/sim65/cfgdata.h +++ b/src/sim65/cfgdata.h @@ -82,7 +82,7 @@ CfgData* NewCfgData (void); void FreeCfgData (CfgData* D); /* Free a config data structure */ -int CfgDataFind (Collection* Attributes, const char* AttrName); +int CfgDataFind (const Collection* Attributes, const char* AttrName); /* Find the attribute with the given name and return its index. Return -1 if * the attribute was not found. */ diff --git a/src/sim65/config.c b/src/sim65/config.c index b65c9a63a..afb5d719b 100644 --- a/src/sim65/config.c +++ b/src/sim65/config.c @@ -139,38 +139,12 @@ static int CmpLocations (void* Data attribute ((unused)), -static int LocationFindAttr (const Location* L, const char* AttrName) -/* Find the attribute with the given name and return its index. Return -1 if - * the attribute was not found. - */ -{ - unsigned I; - - /* Walk through the attributes checking for a "mirror" attribute */ - for (I = 0; I < CollCount (&L->Attributes); ++I) { - - /* Get the next attribute */ - const CfgData* D = CollConstAt (&L->Attributes, I); - - /* Compare the name */ - if (StrCaseCmp (D->Attr, AttrName) == 0) { - /* Found */ - return I; - } - } - - /* Not found */ - return -1; -} - - - static int LocationGetAttr (const Location* L, const char* AttrName) /* Find the attribute with the given name and return it. Call Error() if the * attribute was not found. */ { - int I = LocationFindAttr (L, AttrName); + int I = CfgDataFind (&L->Attributes, AttrName); if (I < 0) { Error ("%s(%u): Attribute `%s' missing", CfgGetName(), L->Line, AttrName); } @@ -183,7 +157,7 @@ static int LocationIsMirror (const Location* L) /* Return true if the given location is a mirror of another one. */ { /* Find the "mirror" attribute */ - return (LocationFindAttr (L, "mirror") >= 0); + return (CfgDataFind (&L->Attributes, "mirror") >= 0); }