[gnome-system-monitor/wip/procinforefactor: 4/5] Make get_writable_memory() a class method



commit 464e3f419c4fe8258a92aa7002c872523b53bd2d
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Sat Aug 3 14:54:06 2013 +0200

    Make get_writable_memory() a class method

 src/procinfo.cpp       |    6 +++---
 src/procinfo.h         |    3 +--
 src/procproperties.cpp |    2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/procinfo.cpp b/src/procinfo.cpp
index 892c725..d9841fa 100644
--- a/src/procinfo.cpp
+++ b/src/procinfo.cpp
@@ -111,12 +111,12 @@ get_process_systemd_info(ProcInfo *info)
 }
 
 void
-get_process_memory_writable (ProcInfo *info)
+ProcInfo::get_writable_memory ()
 {
     glibtop_proc_map buf;
     glibtop_map_entry *maps;
 
-    maps = glibtop_get_proc_map(&buf, info->pid);
+    maps = glibtop_get_proc_map(&buf, this->pid);
 
     gulong memwritable = 0;
     const unsigned number = buf.number;
@@ -130,7 +130,7 @@ get_process_memory_writable (ProcInfo *info)
 #endif
     }
 
-    info->memwritable = memwritable;
+    this->memwritable = memwritable;
 
     g_free(maps);
 }
diff --git a/src/procinfo.h b/src/procinfo.h
index cf30f6c..5fa2d5e 100644
--- a/src/procinfo.h
+++ b/src/procinfo.h
@@ -76,6 +76,7 @@ class ProcInfo
     std::string lookup_user(guint uid);
 
     void update (ProcmanApp *app);
+    void get_writable_memory ();
 
  private:
     typedef std::map<guint, std::string> UserMap;
@@ -90,6 +91,4 @@ class ProcInfo
     static std::map<pid_t, guint64> cpu_times;
 };
 
-void get_process_memory_writable (ProcInfo *info);
-
 #endif /* _GSM_PROCINFO_H_ */
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index 978012a..a022012 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -68,7 +68,7 @@ fill_proc_properties (GtkWidget *tree, ProcInfo *info)
     if (!info)
         return;
 
-    get_process_memory_writable (info);
+    info->get_writable_memory ();
 
 #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
     struct clockinfo cinf;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]