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 /unsupported | |
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 'unsupported')
-rw-r--r-- | unsupported/Platform.c | 2 | ||||
-rw-r--r-- | unsupported/Platform.h | 2 | ||||
-rw-r--r-- | unsupported/ProcessField.h | 15 | ||||
-rw-r--r-- | unsupported/UnsupportedProcess.c | 3 | ||||
-rw-r--r-- | unsupported/UnsupportedProcess.h | 2 |
5 files changed, 17 insertions, 7 deletions
diff --git a/unsupported/Platform.c b/unsupported/Platform.c index c4c45990..75b00502 100644 --- a/unsupported/Platform.c +++ b/unsupported/Platform.c @@ -59,8 +59,6 @@ const MeterClass* const Platform_meterTypes[] = { NULL }; -int Platform_numberOfFields = 100; - ProcessPidColumn Process_pidColumns[] = { { .id = 0, .label = NULL }, }; diff --git a/unsupported/Platform.h b/unsupported/Platform.h index 2b4f0aea..7ba5f063 100644 --- a/unsupported/Platform.h +++ b/unsupported/Platform.h @@ -23,8 +23,6 @@ extern ProcessField Platform_defaultFields[]; extern const MeterClass* const Platform_meterTypes[]; -extern int Platform_numberOfFields; - extern char Process_pidFormat[20]; extern ProcessPidColumn Process_pidColumns[]; diff --git a/unsupported/ProcessField.h b/unsupported/ProcessField.h new file mode 100644 index 00000000..8c07107d --- /dev/null +++ b/unsupported/ProcessField.h @@ -0,0 +1,15 @@ +#ifndef HEADER_UnsupportedProcessField +#define HEADER_UnsupportedProcessField +/* +htop - unsupported/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_UnsupportedProcessField */ diff --git a/unsupported/UnsupportedProcess.c b/unsupported/UnsupportedProcess.c index edac2d62..153f86f6 100644 --- a/unsupported/UnsupportedProcess.c +++ b/unsupported/UnsupportedProcess.c @@ -9,7 +9,7 @@ in the source distribution for its full text. #include "UnsupportedProcess.h" #include <stdlib.h> -ProcessFieldData Process_fields[] = { +ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, }, [PID] = { .name = "PID", .title = " PID ", .description = "Process/thread ID", .flags = 0, }, [COMM] = { .name = "Command", .title = "Command ", .description = "Command line", .flags = 0, }, @@ -35,7 +35,6 @@ ProcessFieldData Process_fields[] = { [TIME] = { .name = "TIME", .title = " TIME+ ", .description = "Total time the process has spent in user and system time", .flags = 0, }, [NLWP] = { .name = "NLWP", .title = "NLWP ", .description = "Number of threads in the process", .flags = 0, }, [TGID] = { .name = "TGID", .title = " TGID ", .description = "Thread group ID (i.e. process ID)", .flags = 0, }, - [100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, }, }; Process* UnsupportedProcess_new(Settings* settings) { diff --git a/unsupported/UnsupportedProcess.h b/unsupported/UnsupportedProcess.h index 8c220944..a9be326e 100644 --- a/unsupported/UnsupportedProcess.h +++ b/unsupported/UnsupportedProcess.h @@ -11,7 +11,7 @@ in the source distribution for its full text. #define Process_delete UnsupportedProcess_delete -extern ProcessFieldData Process_fields[]; +extern ProcessFieldData Process_fields[LAST_PROCESSFIELD]; Process* UnsupportedProcess_new(Settings* settings); |