summaryrefslogtreecommitdiffstats
path: root/libc/bionic/sysinfo.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-01-22 01:52:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-22 01:52:06 +0000
commitd1668a71df761eb1644496f3e2c77c16fd54bb06 (patch)
tree9acfbeb2c5fc1e858bed6db341004df078a2d4ab /libc/bionic/sysinfo.cpp
parent4f11c59b3f3acffe6c8e359296a9e38c4b7edfb6 (diff)
parent8b5df3920f2843c9cdf04160517c1e8b77c992f5 (diff)
downloadbionic-d1668a71df761eb1644496f3e2c77c16fd54bb06.zip
bionic-d1668a71df761eb1644496f3e2c77c16fd54bb06.tar.gz
bionic-d1668a71df761eb1644496f3e2c77c16fd54bb06.tar.bz2
Merge "Turn on -Wold-style-cast and fix the errors."
Diffstat (limited to 'libc/bionic/sysinfo.cpp')
-rw-r--r--libc/bionic/sysinfo.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libc/bionic/sysinfo.cpp b/libc/bionic/sysinfo.cpp
index 6f0afb8..82cb76a 100644
--- a/libc/bionic/sysinfo.cpp
+++ b/libc/bionic/sysinfo.cpp
@@ -83,29 +83,29 @@ int get_nprocs() {
return result;
}
-static int __get_meminfo(const char* pattern) {
+static int __get_meminfo_page_count(const char* pattern) {
FILE* fp = fopen("/proc/meminfo", "re");
if (fp == NULL) {
return -1;
}
- int result = -1;
+ int page_count = -1;
char buf[256];
while (fgets(buf, sizeof(buf), fp) != NULL) {
long total;
if (sscanf(buf, pattern, &total) == 1) {
- result = (int) (total / (PAGE_SIZE/1024));
+ page_count = static_cast<int>(total / (PAGE_SIZE / 1024));
break;
}
}
fclose(fp);
- return result;
+ return page_count;
}
long get_phys_pages() {
- return __get_meminfo("MemTotal: %ld kB");
+ return __get_meminfo_page_count("MemTotal: %ld kB");
}
long get_avphys_pages() {
- return __get_meminfo("MemFree: %ld kB");
+ return __get_meminfo_page_count("MemFree: %ld kB");
}