From c75c5ef9c6631127e5c0f3ace4b59e4acadd04e5 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Thu, 19 Nov 2020 12:32:07 +1100 Subject: Minor cleanups to platform-specific init and done Move platform-specific code out of the htop.c main function and into the platform sub-directories - primarily this is the Linux procfs path check and sensors setup/teardown; not needed on any other platforms. No functional changes here. --- freebsd/Platform.c | 17 +++++++++++++---- freebsd/Platform.h | 6 +++++- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'freebsd') diff --git a/freebsd/Platform.c b/freebsd/Platform.c index 8efa4e68..90fda93e 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -81,10 +81,6 @@ const SignalItem Platform_signals[] = { const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals); -void Platform_setBindings(Htop_Action* keys) { - (void) keys; -} - const MeterClass* const Platform_meterTypes[] = { &CPUMeter_class, &ClockMeter_class, @@ -118,6 +114,19 @@ const MeterClass* const Platform_meterTypes[] = { NULL }; +void Platform_init(void) { + /* no platform-specific setup needed */ +} + +void Platform_done(void) { + /* no platform-specific cleanup needed */ +} + +void Platform_setBindings(Htop_Action* keys) { + /* no platform-specific key bindings */ + (void) keys; +} + int Platform_getUptime() { struct timeval bootTime, currTime; int mib[2] = { CTL_KERN, KERN_BOOTTIME }; diff --git a/freebsd/Platform.h b/freebsd/Platform.h index 5e3b29fb..64222b3d 100644 --- a/freebsd/Platform.h +++ b/freebsd/Platform.h @@ -26,9 +26,13 @@ extern const SignalItem Platform_signals[]; extern const unsigned int Platform_numberOfSignals; +extern const MeterClass* const Platform_meterTypes[]; + void Platform_setBindings(Htop_Action* keys); -extern const MeterClass* const Platform_meterTypes[]; +void Platform_init(void); + +void Platform_done(void); int Platform_getUptime(void); -- cgit v1.2.3 From 82a69ee87af4aec4b5520d55c4949f287f4e6708 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 23 Nov 2020 17:32:57 +1100 Subject: Consistent ordering of function declarations for FreeBSD --- freebsd/Platform.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'freebsd') diff --git a/freebsd/Platform.h b/freebsd/Platform.h index 64222b3d..b493ed82 100644 --- a/freebsd/Platform.h +++ b/freebsd/Platform.h @@ -28,12 +28,12 @@ extern const unsigned int Platform_numberOfSignals; extern const MeterClass* const Platform_meterTypes[]; -void Platform_setBindings(Htop_Action* keys); - void Platform_init(void); void Platform_done(void); +void Platform_setBindings(Htop_Action* keys); + int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -- cgit v1.2.3