about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-06-18T15·20+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-06-18T15·20+0000
commit5af84139a8d04ad9fdb2c02bc242ce5cd50b87b9 (patch)
tree4c8292835dd77eac32e06ffa28bf7c89d1ae12ed /src/libutil
parentd3aa183beb774c20cb77052248cf45e684d134fb (diff)
* --max-freed: support values >= 4 GB.
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc8
-rw-r--r--src/libutil/util.hh1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 1873ccfe536c..4f6c367da8b1 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1020,6 +1020,14 @@ bool string2Int(const string & s, int & n)
 }
 
 
+bool string2Int(const string & s, long long & n)
+{
+    std::istringstream str(s);
+    str >> n;
+    return str && str.get() == EOF;
+}
+
+
 void ignoreException()
 {
     try {
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index d1e30fa6b9e3..5d28a8308cb8 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -287,6 +287,7 @@ bool statusOk(int status);
 /* Parse a string into an integer. */
 string int2String(int n);
 bool string2Int(const string & s, int & n);
+bool string2Int(const string & s, long long & n);
 
 
 /* Exception handling in destructors: print an error message, then