[gnome-system-monitor] Fixed compilation after the transition from char* to std::string.



commit 6ae705dc8477037f5930f319348e5c72053bd9f5
Author: Benoît Dejean <bdejean gmail com>
Date:   Mon May 22 18:49:08 2017 +0200

    Fixed compilation after the transition from char* to std::string.

 src/systemd.cpp |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/src/systemd.cpp b/src/systemd.cpp
index 2c3c1a2..880fc4c 100644
--- a/src/systemd.cpp
+++ b/src/systemd.cpp
@@ -40,20 +40,19 @@ procman::get_process_systemd_info(ProcInfo *info)
     if (!systemd_logind_running())
         return;
 
-    free(info->unit);
-    info->unit = NULL;
-    sd_pid_get_unit(info->pid, &info->unit);
-
-    free(info->session);
-    info->session = NULL;
-    sd_pid_get_session(info->pid, &info->session);
-
-    free(info->seat);
-    info->seat = NULL;
-
-    if (info->session != NULL)
-        sd_session_get_seat(info->session, &info->seat);
-
+    char* unit = NULL;
+    sd_pid_get_unit(info->pid, &unit);
+    info->unit = make_string(unit);
+
+    char* session = NULL;
+    sd_pid_get_session(info->pid, &session);
+    info->session = make_string(session);
+
+    if (!info->session.empty()) {
+      char* seat = NULL;
+      sd_session_get_seat(info->session.c_str(), &seat);
+      info->seat = make_string(seat);
+    }
     if (sd_pid_get_owner_uid(info->pid, &uid) >= 0)
         info->owner = info->lookup_user(uid);
     else


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