File kdump-fate318842-0002-revert-getMemorySize.patch of Package kdump
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 17 Sep 2015 13:41:40 +0200
Subject: Revert "New utility function: getMemorySize"
References: FATE#318842, bsc#882082
Patch-mainline: v0.8.16
Git-commit: 57725449683b614c59e683809a5ba7ba838241a9
Rip off Util::getMemorySize(), because it is dead code now.
This reverts commit 39ffd3567de3c0393600855192bc65bac0cb3d1f.
---
kdumptool/util.cc | 29 -----------------------------
kdumptool/util.h | 6 ------
2 files changed, 35 deletions(-)
--- a/kdumptool/util.cc
+++ b/kdumptool/util.cc
@@ -20,8 +20,6 @@
#include <cstring>
#include <cstdlib>
#include <cerrno>
-#include <fstream>
-#include <sstream>
#include <unistd.h>
#include <fcntl.h>
@@ -35,15 +33,12 @@
#include "global.h"
#include "util.h"
-#include "stringutil.h"
#include "debug.h"
using std::string;
using std::strerror;
using std::getenv;
-#define PROC_MEMINFO "/proc/meminfo"
-
// -----------------------------------------------------------------------------
std::string Util::getArch()
throw (KError)
@@ -347,30 +342,6 @@ bool Util::isX86(const string &arch)
}
// -----------------------------------------------------------------------------
-unsigned long Util::getMemorySize()
- throw (KError)
-{
- unsigned long ret = 0;
-
- std::ifstream fin(PROC_MEMINFO);
- if (!fin) {
- throw KError("Unable to read " PROC_MEMINFO);
- }
-
- KString s;
- while (std::getline(fin, s)) {
- if (s.startsWith("MemTotal:")) {
- std::istringstream split(s);
- split >> s >> ret;
- break;
- }
- }
-
- fin.close();
- return ret;
-}
-
-// -----------------------------------------------------------------------------
void Util::daemonize()
throw (KError)
{
--- a/kdumptool/util.h
+++ b/kdumptool/util.h
@@ -53,12 +53,6 @@ class Util {
static bool isX86(const std::string &arch)
throw ();
- /*
- * Get memory size (in KBytes)
- */
- static unsigned long getMemorySize()
- throw (KError);
-
/**
* Checks if the specified file is a gzip compressed file.
*