Simplify function calls for extensionsTurnedOn().
Lots of places in the code use extensionsTurnedOn(1, ...). This patch introduces a new method, extensionTurnedOn(), for testing if a single extension is turned on.
This commit is contained in:
parent
3a194f7ba4
commit
c4d20e0041
4 changed files with 28 additions and 22 deletions
|
|
@ -448,20 +448,25 @@ TExtensionBehavior TParseContext::getExtensionBehavior(const char* extension)
|
|||
return iter->second;
|
||||
}
|
||||
|
||||
// Returns true if the given extension is set to enable, require, or warn.
|
||||
bool TParseContext::extensionTurnedOn(const char* const extension)
|
||||
{
|
||||
switch (getExtensionBehavior(extension)) {
|
||||
case EBhEnable:
|
||||
case EBhRequire:
|
||||
case EBhWarn:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// See if any of the extensions are set to enable, require, or warn.
|
||||
bool TParseContext::extensionsTurnedOn(int numExtensions, const char* const extensions[])
|
||||
{
|
||||
for (int i = 0; i < numExtensions; ++i) {
|
||||
switch (getExtensionBehavior(extensions[i])) {
|
||||
case EBhEnable:
|
||||
case EBhRequire:
|
||||
case EBhWarn:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (extensionTurnedOn(extensions[i])) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue