Turn on -Wold-style-cast and fix the errors.
A couple of dodgy cases where we cast away const, but otherwise pretty boring.
Change-Id: Ibc39ebd525377792b5911464be842121c20f03b9
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 @@
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");
}