mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: drop dubious string::expand recursion
- was used for on-the-fly, but not needed anymore
This commit is contained in:
@ -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
|
||||
(
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user