From 5d157456ed77c9c704bf9b9b441eade671c4191c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 5 Jan 2014 18:53:23 +0100 Subject: [PATCH] dboxinfo: remove impossible case The kernel does (and has always) report memory in kib units, so there is no need to check this. --- src/gui/dboxinfo.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 5e45f102e..187a2738e 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -237,12 +237,8 @@ void CDBoxInfoWidget::paint() char buf[80], a[80]; long long unsigned v; while (fgets(buf, sizeof(buf), procmeminfo)) { - char unit[10]; - *unit = 0; - if ((3 == sscanf(buf, "%[^:]: %llu %s", a, &v, unit)) - || (2 == sscanf(buf, "%[^:]: %llu", a, &v))) { - if (*unit == 'k') - v <<= 10; + if (2 == sscanf(buf, "%[^:]: %llu", a, &v)) { + v <<= 10; if (!strcasecmp(a, "MemTotal")) memstat[MEMINFO_RAM][MEMINFO_TOTAL] += v; else if (!strcasecmp(a, "MemFree"))