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.
This commit is contained in:
Nathan Scott
2020-11-19 12:32:07 +11:00
parent 329011bb98
commit c75c5ef9c6
15 changed files with 157 additions and 86 deletions

View File

@ -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 };

View File

@ -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);