From 8b5df3920f2843c9cdf04160517c1e8b77c992f5 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 21 Jan 2015 16:19:07 -0800 Subject: 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 --- libc/bionic/sysinfo.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libc/bionic/sysinfo.cpp') 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(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"); } -- cgit v1.1