diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2014-09-20 17:17:49 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2014-09-20 17:17:49 -0400 |
commit | 0fa128bbd0a53a3428fa2028b8754e15c9ef7c38 (patch) | |
tree | 30e2598a67f540e97cdbaf1cf7f5092b974d9d3c /src/sim | |
parent | b2c2e67468bba6dbbbfb6856ca94fdcfa1492258 (diff) | |
download | gem5-0fa128bbd0a53a3428fa2028b8754e15c9ef7c38.tar.xz |
base: Clean up redundant string functions and use C++11
This patch does a bit of housekeeping on the string helper functions
and relies on the C++11 standard library where possible. It also does
away with our custom string hash as an implementation is already part
of the standard library.
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/serialize.cc | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index 18af044d0..27bf87254 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -111,38 +111,25 @@ showParam(ostream &os, const unsigned char &value) } -// Use sscanf() for FP types as to_number() only handles integers template <> bool parseParam(const string &s, float &value) { - return (sscanf(s.c_str(), "%f", &value) == 1); + return to_number(s, value); } template <> bool parseParam(const string &s, double &value) { - return (sscanf(s.c_str(), "%lf", &value) == 1); + return to_number(s, value); } template <> bool parseParam(const string &s, bool &value) { - const string &ls = to_lower(s); - - if (ls == "true") { - value = true; - return true; - } - - if (ls == "false") { - value = false; - return true; - } - - return false; + return to_bool(s, value); } // Display bools as strings |