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); }