summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-03-18 08:23:07 +1100
committerNathan Scott <nathans@redhat.com>2021-03-22 17:16:40 +1100
commitd56d23d91adf3fad512e5311fcdd0ca129e820c7 (patch)
tree8c6d3059243904dde7689d38bacf72366bd04d4f
parent0ada9f325f69ddb0f917f023fa701ce7669cd370 (diff)
Each platform defines its own long opt macro, prefer printf
Follow up on the two items of feedback from cgzones review, and resolve a build failure picked up by CI on Mac OS X. Related to https://github.com/htop-dev/htop/pull/564
-rw-r--r--darwin/Platform.h5
-rw-r--r--dragonflybsd/Platform.h5
-rw-r--r--freebsd/Platform.h5
-rw-r--r--htop.c12
-rw-r--r--openbsd/Platform.h5
-rw-r--r--solaris/Platform.h5
-rw-r--r--unsupported/Platform.h5
7 files changed, 26 insertions, 16 deletions
diff --git a/darwin/Platform.h b/darwin/Platform.h
index ea0c8197..af95db9c 100644
--- a/darwin/Platform.h
+++ b/darwin/Platform.h
@@ -23,6 +23,9 @@ in the source distribution for its full text.
#include "generic/uname.h"
+#define PLATFORM_LONG_OPTIONS
+#define PLATFORM_LONG_OPTIONS_USAGE
+
extern const ProcessField Platform_defaultFields[];
extern double Platform_timebaseToNS;
@@ -77,7 +80,7 @@ static inline void Platform_getRelease(char** string) {
*string = Generic_uname();
}
-static bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
+static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
return false;
}
diff --git a/dragonflybsd/Platform.h b/dragonflybsd/Platform.h
index 213936cc..9ddcbc70 100644
--- a/dragonflybsd/Platform.h
+++ b/dragonflybsd/Platform.h
@@ -21,6 +21,9 @@ in the source distribution for its full text.
#include "generic/uname.h"
+#define PLATFORM_LONG_OPTIONS
+#define PLATFORM_LONG_OPTIONS_USAGE
+
extern const ProcessField Platform_defaultFields[];
extern const SignalItem Platform_signals[];
@@ -67,7 +70,7 @@ static inline void Platform_getRelease(char** string) {
*string = Generic_uname();
}
-static bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
+static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
return false;
}
diff --git a/freebsd/Platform.h b/freebsd/Platform.h
index 93fd33e0..678579e3 100644
--- a/freebsd/Platform.h
+++ b/freebsd/Platform.h
@@ -22,6 +22,9 @@ in the source distribution for its full text.
#include "generic/uname.h"
+#define PLATFORM_LONG_OPTIONS
+#define PLATFORM_LONG_OPTIONS_USAGE
+
extern const ProcessField Platform_defaultFields[];
extern const SignalItem Platform_signals[];
@@ -72,7 +75,7 @@ static inline void Platform_getRelease(char** string) {
*string = Generic_uname();
}
-static bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
+static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
return false;
}
diff --git a/htop.c b/htop.c
index 892057ea..15eb2a4b 100644
--- a/htop.c
+++ b/htop.c
@@ -36,20 +36,12 @@ in the source distribution for its full text.
#include "XUtils.h"
-#ifndef PLATFORM_LONG_OPTIONS
-#define PLATFORM_LONG_OPTIONS
-#endif
-
-#ifndef PLATFORM_LONG_OPTIONS_USAGE
-#define PLATFORM_LONG_OPTIONS_USAGE
-#endif
-
static void printVersionFlag(const char* name) {
- fprintf(stdout, "%s " VERSION "\n", name);
+ printf("%s " VERSION "\n", name);
}
static void printHelpFlag(const char* name) {
- fprintf(stdout, "%s " VERSION "\n"
+ printf("%s " VERSION "\n"
COPYRIGHT "\n"
"Released under the GNU GPLv2.\n\n"
"-C --no-color Use a monochrome color scheme\n"
diff --git a/openbsd/Platform.h b/openbsd/Platform.h
index ba7348ce..c4add09f 100644
--- a/openbsd/Platform.h
+++ b/openbsd/Platform.h
@@ -23,6 +23,9 @@ in the source distribution for its full text.
#include "generic/uname.h"
+#define PLATFORM_LONG_OPTIONS
+#define PLATFORM_LONG_OPTIONS_USAGE
+
extern const ProcessField Platform_defaultFields[];
/* see /usr/include/sys/signal.h */
@@ -70,7 +73,7 @@ static inline void Platform_getRelease(char** string) {
*string = Generic_uname();
}
-static bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
+static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
return false;
}
diff --git a/solaris/Platform.h b/solaris/Platform.h
index cabfd5c9..4485cbbf 100644
--- a/solaris/Platform.h
+++ b/solaris/Platform.h
@@ -26,6 +26,9 @@ in the source distribution for its full text.
#include "generic/uname.h"
+#define PLATFORM_LONG_OPTIONS
+#define PLATFORM_LONG_OPTIONS_USAGE
+
#define kill(pid, signal) kill(pid / 1024, signal)
typedef struct var kvar_t;
@@ -89,7 +92,7 @@ static inline void Platform_getRelease(char** string) {
*string = Generic_uname();
}
-static bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
+static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
return false;
}
diff --git a/unsupported/Platform.h b/unsupported/Platform.h
index d95feee5..8df948ef 100644
--- a/unsupported/Platform.h
+++ b/unsupported/Platform.h
@@ -17,6 +17,9 @@ in the source distribution for its full text.
#include "UnsupportedProcess.h"
+#define PLATFORM_LONG_OPTIONS
+#define PLATFORM_LONG_OPTIONS_USAGE
+
extern const SignalItem Platform_signals[];
extern const unsigned int Platform_numberOfSignals;
@@ -61,7 +64,7 @@ void Platform_getHostname(char* buffer, size_t size);
void Platform_getRelease(char** string);
-static bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
+static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
return false;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy