git-svn-id: svn://svn.cc65.org/cc65/trunk@2100 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-04-28 21:54:06 +00:00
parent 459cfb06c1
commit 09629cd229
3 changed files with 5 additions and 31 deletions

View File

@@ -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 /* Find the attribute with the given name and return its index. Return -1 if
* the attribute was not found. * the attribute was not found.
*/ */

View File

@@ -82,7 +82,7 @@ CfgData* NewCfgData (void);
void FreeCfgData (CfgData* D); void FreeCfgData (CfgData* D);
/* Free a config data structure */ /* 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 /* Find the attribute with the given name and return its index. Return -1 if
* the attribute was not found. * the attribute was not found.
*/ */

View File

@@ -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) static int LocationGetAttr (const Location* L, const char* AttrName)
/* Find the attribute with the given name and return it. Call Error() if the /* Find the attribute with the given name and return it. Call Error() if the
* attribute was not found. * attribute was not found.
*/ */
{ {
int I = LocationFindAttr (L, AttrName); int I = CfgDataFind (&L->Attributes, AttrName);
if (I < 0) { if (I < 0) {
Error ("%s(%u): Attribute `%s' missing", CfgGetName(), L->Line, AttrName); 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. */ /* Return true if the given location is a mirror of another one. */
{ {
/* Find the "mirror" attribute */ /* Find the "mirror" attribute */
return (LocationFindAttr (L, "mirror") >= 0); return (CfgDataFind (&L->Attributes, "mirror") >= 0);
} }