Skip to content
Snippets Groups Projects
Commit 5ab254d5 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: drop dubious string::expand recursion

- was used for on-the-fly, but not needed anymore
parent 97a15a8b
Branches
Tags
No related merge requests found
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment