From e04c3d044060069aa4be645a64b09194c9efe0c6 Mon Sep 17 00:00:00 2001
From: Robin Lee <cheeselee@fedoraproject.org>
Date: Sun, 1 Nov 2020 17:27:31 +0800
Subject: [PATCH 1/2] fix: remove multidefs
remove multidefs
Log:
Signed-off-by: Robin Lee <cheeselee@fedoraproject.org>
---
src/process/desktop_entry_stat.cpp | 5 +++--
src/process/process_stat.cpp | 5 +++--
src/process/system_stat.cpp | 4 ++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/process/desktop_entry_stat.cpp b/src/process/desktop_entry_stat.cpp
index 4281e07..bdf1136 100644
--- a/src/process/desktop_entry_stat.cpp
+++ b/src/process/desktop_entry_stat.cpp
@@ -34,10 +34,11 @@ DCORE_USE_NAMESPACE
static const int kUpdateInterval = 1000 * 300; // 5 minutes interval
-auto print_err = [](decltype(errno) e, const QString &msg)
+// error debug output utility
+static void print_err(decltype(errno) e, const QString &msg)
{
qDebug() << QString("Error: [%1] %2, ").arg(e).arg(strerror(e)) << msg;
-};
+}
DesktopEntryStat::DesktopEntryStat(QObject *parent) : QObject(parent)
{
diff --git a/src/process/process_stat.cpp b/src/process/process_stat.cpp
index 58b7854..92be119 100644
--- a/src/process/process_stat.cpp
+++ b/src/process/process_stat.cpp
@@ -40,10 +40,11 @@
#define PROC_FD_NAME_PATH "/proc/%u/fd/%s"
#define PROC_SCHEDSTAT_PATH "/proc/%u/schedstat"
-auto print_err = [](decltype(errno) e, const QString &msg)
+// util to pring error message
+static void print_err(decltype(errno) e, const QString &msg)
{
qDebug() << QString("Error: [%1] %2, ").arg(e).arg(strerror(e)) << msg;
-};
+}
// ref: sysstat#common.c#get_kb_shift
static inline unsigned int get_kb_shift(void)
diff --git a/src/process/system_stat.cpp b/src/process/system_stat.cpp
index fe8d304..47d6633 100644
--- a/src/process/system_stat.cpp
+++ b/src/process/system_stat.cpp
@@ -48,10 +48,10 @@
#define MAX_NAME_LEN 128
-auto print_err = [](decltype(errno) e, const QString &msg)
+static void print_err(decltype(errno) e, const QString &msg)
{
qDebug() << QString("Error: [%1] %2, ").arg(e).arg(strerror(e)) << msg;
-};
+}
bool SystemStat::readUpTime(qulonglong &uptime)
{
--
2.26.2