diff options
author | Abhijit Pawar <apawar@cybage.com> | 2013-06-10 11:07:27 +0530 |
---|---|---|
committer | Matt Kangas <matt.kangas@10gen.com> | 2013-06-10 18:45:11 -0400 |
commit | 283623c7a30326a7baf93fc08ac74162f8d3a50f (patch) | |
tree | 29865f7ba5f1822e4811346425849a54ebba43ea /src | |
parent | 64a1136d69b700d9e7e40e7fd8c43f9a8108ac76 (diff) | |
download | mongo-283623c7a30326a7baf93fc08ac74162f8d3a50f.tar.gz |
core/util: remove atoll and use parsenumberfromstring
This patch replace atoll with stable parsenumberfromstring().
Signed-off-by: Matt Kangas <matt.kangas@10gen.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/util/processinfo_linux2.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/util/processinfo_linux2.cpp b/src/mongo/util/processinfo_linux2.cpp index 6544fb7af83..f191e6da84a 100644 --- a/src/mongo/util/processinfo_linux2.cpp +++ b/src/mongo/util/processinfo_linux2.cpp @@ -343,11 +343,15 @@ namespace mongo { // trim whitespace and append 000 to replace kB. while ( isspace( meminfo.at( lineOff ) ) ) lineOff++; meminfo = meminfo.substr( lineOff ); + + unsigned long long systemMem = 0; + if ( mongo::parseNumberFromString( meminfo, &systemMem ).isOK() ) { + return systemMem * 1024; // convert from kB to bytes + } + else + log() << "Unable to collect system memory information" << endl; } - else { - meminfo = ""; - } - return atoll(meminfo.c_str()) * 1024; // convert from kB to bytes + return 0; } }; |