STYLE: drop dubious string::expand recursion

- was used for on-the-fly, but not needed anymore
This commit is contained in:
Mark Olesen
2011-02-23 15:18:01 +01:00
parent 97a15a8b06
commit 5ab254d5b0
2 changed files with 6 additions and 15 deletions

View File

@ -93,8 +93,7 @@ Foam::string& Foam::string::replaceAll
}
// Expand all occurences of environment variables and initial tilde sequences
Foam::string& Foam::string::expand(const bool recurse, const bool allowEmptyVar)
Foam::string& Foam::string::expand(const bool allowEmpty)
{
size_type begVar = 0;
@ -134,20 +133,15 @@ Foam::string& Foam::string::expand(const bool recurse, const bool allowEmptyVar)
if (endVar != npos && endVar != begVar)
{
string varName = substr
const string varName = substr
(
begVar + 1 + delim,
endVar - begVar - 2*delim
);
string varValue = getEnv(varName);
const string varValue = getEnv(varName);
if (varValue.size())
{
if (recurse)
{
varValue.expand(recurse, allowEmptyVar);
}
std::string::replace
(
begVar,
@ -156,7 +150,7 @@ Foam::string& Foam::string::expand(const bool recurse, const bool allowEmptyVar)
);
begVar += varValue.size();
}
else if (allowEmptyVar)
else if (allowEmpty)
{
std::string::replace
(

View File

@ -180,13 +180,10 @@ public:
// - leading "~user" : home directory for specified user
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
//
// Any unknown entries are removed silently if allowEmpty is true
// \sa
// Foam::findEtcFile
string& expand
(
const bool recurse=false,
const bool allowEmptyVar = false
);
string& expand(const bool allowEmpty = false);
//- Remove repeated characters returning true if string changed
bool removeRepeated(const char);