diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-08-26 16:48:01 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-08-26 16:48:01 +0000 |
commit | 8a6080eb1400b9b7414e2ec8b995268315448cb5 (patch) | |
tree | 8d0fffcb5f9a15337cb15b37666d2b75ebddd0d0 /src/libutil | |
parent | 4b66cebe7bf1a8c03fb8f1e0052c19e91820c66c (diff) | |
download | guix-8a6080eb1400b9b7414e2ec8b995268315448cb5.tar.gz |
* Refactoring.
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 13 | ||||
-rw-r--r-- | src/libutil/util.hh | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index f34bd9e059..02745498f9 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -360,10 +360,7 @@ Nest::~Nest() static string escVerbosity(Verbosity level) { - int l = (int) level; - ostringstream st; - st << l; - return st.str(); + return int2String((int) level); } @@ -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) { istringstream str(s); diff --git a/src/libutil/util.hh b/src/libutil/util.hh index fcf995af8a..22e614d958 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -292,6 +292,7 @@ bool statusOk(int status); /* Parse a string into an integer. */ +string int2String(int n); bool string2Int(const string & s, int & n); |