summaryrefslogtreecommitdiff
path: root/src/base/hostinfo.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2012-08-06 16:52:49 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2012-08-06 16:52:49 -0700
commitb647b48bf4d980e26b4626e94f1207ad66fc324e (patch)
tree552ff31c06305500cde480a456a152d94f9e1293 /src/base/hostinfo.cc
parentd55115936e0711422c6d708572b391e15432bec1 (diff)
downloadgem5-b647b48bf4d980e26b4626e94f1207ad66fc324e.tar.xz
str: add an overloaded startswith() utility method
for various string types and use it in a few places.
Diffstat (limited to 'src/base/hostinfo.cc')
-rw-r--r--src/base/hostinfo.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc
index 857ccfa7f..15413de2a 100644
--- a/src/base/hostinfo.cc
+++ b/src/base/hostinfo.cc
@@ -45,6 +45,7 @@
#include <string>
#include "base/misc.hh"
+#include "base/str.hh"
#include "base/types.hh"
using namespace std;
@@ -77,7 +78,7 @@ procInfo(const char *filename, const char *target)
while (fp && !feof(fp) && !done) {
if (fgets(line, 80, fp)) {
- if (strncmp(line, target, strlen(target)) == 0) {
+ if (startswith(line, target)) {
snprintf(format, sizeof(format), "%s %%ld", target);
sscanf(line, format, &usage);