mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 00:29:31 +00:00
Working
git-svn-id: svn://svn.cc65.org/cc65/trunk@2100 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
459cfb06c1
commit
09629cd229
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user