* Refactoring.

This commit is contained in:
Eelco Dolstra 2006-08-26 16:48:01 +00:00
parent 4b66cebe7b
commit 8a6080eb14
3 changed files with 11 additions and 10 deletions

View file

@ -146,12 +146,7 @@ static void processBinding(EvalState & state, Expr e, Derivation & drv,
else if (matchUri(e, s)) ss.push_back(aterm2String(s)); else if (matchUri(e, s)) ss.push_back(aterm2String(s));
else if (e == eTrue) ss.push_back("1"); else if (e == eTrue) ss.push_back("1");
else if (e == eFalse) ss.push_back(""); else if (e == eFalse) ss.push_back("");
else if (matchInt(e, n)) ss.push_back(int2String(n));
else if (matchInt(e, n)) {
ostringstream st;
st << n;
ss.push_back(st.str());
}
else if (matchAttrs(e, es)) { else if (matchAttrs(e, es)) {
Expr a = queryAttr(e, "type"); Expr a = queryAttr(e, "type");

View file

@ -360,10 +360,7 @@ Nest::~Nest()
static string escVerbosity(Verbosity level) static string escVerbosity(Verbosity level)
{ {
int l = (int) level; return int2String((int) level);
ostringstream st;
st << l;
return st.str();
} }
@ -829,6 +826,14 @@ bool statusOk(int status)
} }
string int2String(int n)
{
ostringstream str;
str << n;
return str.str();
}
bool string2Int(const string & s, int & n) bool string2Int(const string & s, int & n)
{ {
istringstream str(s); istringstream str(s);

View file

@ -292,6 +292,7 @@ bool statusOk(int status);
/* Parse a string into an integer. */ /* Parse a string into an integer. */
string int2String(int n);
bool string2Int(const string & s, int & n); bool string2Int(const string & s, int & n);