diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-12-15 19:44:48 +0100 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2020-12-19 21:13:32 +0100 |
commit | 89473cc9ae950bbb5e291d1f186d372f66f66394 (patch) | |
tree | d1e21dbd0df28c00c467695711c8dde884e746a1 /openbsd | |
parent | d872e363081a892d65dede6a90721d3a2e8b0ee6 (diff) |
Rework enum ProcessField
Use only one enum instead of a global and a platform specific one.
Drop Platform_numberOfFields global variable.
Set known size of Process_fields array
Diffstat (limited to 'openbsd')
-rw-r--r-- | openbsd/OpenBSDProcess.c | 10 | ||||
-rw-r--r-- | openbsd/OpenBSDProcess.h | 7 | ||||
-rw-r--r-- | openbsd/Platform.c | 2 | ||||
-rw-r--r-- | openbsd/Platform.h | 4 | ||||
-rw-r--r-- | openbsd/ProcessField.h | 15 |
5 files changed, 18 insertions, 20 deletions
diff --git a/openbsd/OpenBSDProcess.c b/openbsd/OpenBSDProcess.c index 9756f9bb..0ac08c66 100644 --- a/openbsd/OpenBSDProcess.c +++ b/openbsd/OpenBSDProcess.c @@ -16,7 +16,7 @@ in the source distribution for its full text. #include "XUtils.h" -ProcessFieldData Process_fields[] = { +ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [0] = { .name = "", .title = NULL, @@ -167,12 +167,6 @@ ProcessFieldData Process_fields[] = { .description = "Thread group ID (i.e. process ID)", .flags = 0, }, - [LAST_PROCESSFIELD] = { - .name = "*** report bug! ***", - .title = NULL, - .description = NULL, - .flags = 0, - }, }; ProcessPidColumn Process_pidColumns[] = { @@ -219,7 +213,7 @@ static long OpenBSDProcess_compareByKey(const Process* v1, const Process* v2, Pr // remove if actually used (void)p1; (void)p2; - switch ((int) key) { + switch (key) { // add OpenBSD-specific fields here default: return Process_compareByKey_Base(v1, v2, key); diff --git a/openbsd/OpenBSDProcess.h b/openbsd/OpenBSDProcess.h index 2d015136..6b28025a 100644 --- a/openbsd/OpenBSDProcess.h +++ b/openbsd/OpenBSDProcess.h @@ -15,11 +15,6 @@ in the source distribution for its full text. #include "Settings.h" -typedef enum OpenBSDProcessFields_ { - // Add platform-specific fields here, with ids >= 100 - LAST_PROCESSFIELD = 100, -} OpenBSDProcessField; - typedef struct OpenBSDProcess_ { Process super; } OpenBSDProcess; @@ -30,7 +25,7 @@ typedef struct OpenBSDProcess_ { extern const ProcessClass OpenBSDProcess_class; -extern ProcessFieldData Process_fields[]; +extern ProcessFieldData Process_fields[LAST_PROCESSFIELD]; extern ProcessPidColumn Process_pidColumns[]; diff --git a/openbsd/Platform.c b/openbsd/Platform.c index dae80724..30a58ec4 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -44,8 +44,6 @@ in the source distribution for its full text. ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_VIRT, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; -int Platform_numberOfFields = LAST_PROCESSFIELD; - /* * See /usr/include/sys/signal.h */ diff --git a/openbsd/Platform.h b/openbsd/Platform.h index 0e2d435f..4774f921 100644 --- a/openbsd/Platform.h +++ b/openbsd/Platform.h @@ -20,12 +20,8 @@ in the source distribution for its full text. #include "SignalsPanel.h" -extern ProcessFieldData Process_fields[]; - extern ProcessField Platform_defaultFields[]; -extern int Platform_numberOfFields; - /* see /usr/include/sys/signal.h */ extern const SignalItem Platform_signals[]; diff --git a/openbsd/ProcessField.h b/openbsd/ProcessField.h new file mode 100644 index 00000000..be4e51e7 --- /dev/null +++ b/openbsd/ProcessField.h @@ -0,0 +1,15 @@ +#ifndef HEADER_OpenBSDProcessField +#define HEADER_OpenBSDProcessField +/* +htop - openbsd/ProcessField.h +(C) 2020 htop dev team +Released under the GNU GPLv2, see the COPYING file +in the source distribution for its full text. +*/ + + +#define PLATFORM_PROCESS_FIELDS \ + // End of list + + +#endif /* HEADER_OpenBSDProcessField */ |