From c3952e7c20a3108c2f16aa579f8062dfc2163bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 8 Sep 2020 14:28:34 +0200 Subject: [PATCH] Use strict function prototypes int foo(); declares a function taking any number of arguments. --- Action.c | 4 ++-- Action.h | 4 ++-- CRT.h | 12 ++++++------ MainPanel.h | 2 +- Process.h | 2 +- SignalsPanel.h | 2 +- UsersTable.h | 2 +- darwin/Platform.h | 4 ++-- dragonflybsd/Platform.h | 4 ++-- freebsd/Platform.h | 4 ++-- htop.c | 4 ++-- linux/Battery.c | 4 ++-- linux/Platform.h | 4 ++-- openbsd/Platform.h | 4 ++-- solaris/Platform.h | 4 ++-- unsupported/Platform.h | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Action.c b/Action.c index 5de0804d..33320caf 100644 --- a/Action.c +++ b/Action.c @@ -272,7 +272,7 @@ static Htop_Reaction actionExpandCollapseOrSortColumn(State* st) { return st->settings->treeView ? actionExpandOrCollapse(st) : actionSetSortColumn(st); } -static Htop_Reaction actionQuit() { +static Htop_Reaction actionQuit(ATTR_UNUSED State* st) { return HTOP_QUIT; } @@ -386,7 +386,7 @@ static Htop_Reaction actionTag(State* st) { return HTOP_OK; } -static Htop_Reaction actionRedraw() { +static Htop_Reaction actionRedraw(ATTR_UNUSED State *st) { clear(); return HTOP_REFRESH | HTOP_REDRAW_BAR; } diff --git a/Action.h b/Action.h index 0ec0537f..0623e37d 100644 --- a/Action.h +++ b/Action.h @@ -24,8 +24,6 @@ typedef enum { HTOP_UPDATE_PANELHDR = 0x41, // implies HTOP_REFRESH } Htop_Reaction; -typedef Htop_Reaction (*Htop_Action)(); - typedef struct State_ { Settings* settings; UsersTable* ut; @@ -34,6 +32,8 @@ typedef struct State_ { Header* header; } State; +typedef Htop_Reaction (*Htop_Action)(State* st); + Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess); bool Action_setUserOnly(const char* userName, uid_t* userId); diff --git a/CRT.h b/CRT.h index d7d01e2c..20ef283e 100644 --- a/CRT.h +++ b/CRT.h @@ -149,9 +149,9 @@ extern void *backtraceArray[128]; #if HAVE_SETUID_ENABLED -void CRT_dropPrivileges(); +void CRT_dropPrivileges(void); -void CRT_restorePrivileges(); +void CRT_restorePrivileges(void); #else @@ -166,15 +166,15 @@ void CRT_restorePrivileges(); void CRT_init(int delay, int colorScheme, bool allowUnicode); -void CRT_done(); +void CRT_done(void); void CRT_fatalError(const char* note); -int CRT_readKey(); +int CRT_readKey(void); -void CRT_disableDelay(); +void CRT_disableDelay(void); -void CRT_enableDelay(); +void CRT_enableDelay(void); void CRT_setColors(int colorScheme); diff --git a/MainPanel.h b/MainPanel.h index ca064722..01fb4977 100644 --- a/MainPanel.h +++ b/MainPanel.h @@ -36,7 +36,7 @@ bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Ar extern PanelClass MainPanel_class; -MainPanel* MainPanel_new(); +MainPanel* MainPanel_new(void); void MainPanel_setState(MainPanel* this, State* state); diff --git a/Process.h b/Process.h index ebf5cdf4..82f6d6c8 100644 --- a/Process.h +++ b/Process.h @@ -169,7 +169,7 @@ typedef struct ProcessClass_ { extern char Process_pidFormat[20]; -void Process_setupColumnWidths(); +void Process_setupColumnWidths(void); void Process_humanNumber(RichString* str, unsigned long number, bool coloring); diff --git a/SignalsPanel.h b/SignalsPanel.h index 3d910cee..460c81e7 100644 --- a/SignalsPanel.h +++ b/SignalsPanel.h @@ -12,6 +12,6 @@ typedef struct SignalItem_ { int number; } SignalItem; -Panel* SignalsPanel_new(); +Panel* SignalsPanel_new(void); #endif diff --git a/UsersTable.h b/UsersTable.h index fb3eaedd..327bc087 100644 --- a/UsersTable.h +++ b/UsersTable.h @@ -13,7 +13,7 @@ typedef struct UsersTable_ { Hashtable* users; } UsersTable; -UsersTable* UsersTable_new(); +UsersTable* UsersTable_new(void); void UsersTable_delete(UsersTable* this); diff --git a/darwin/Platform.h b/darwin/Platform.h index 7dd4ae60..6c038587 100644 --- a/darwin/Platform.h +++ b/darwin/Platform.h @@ -28,11 +28,11 @@ void Platform_setBindings(Htop_Action* keys); extern int Platform_numberOfFields; -int Platform_getUptime(); +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); extern ProcessPidColumn Process_pidColumns[]; diff --git a/dragonflybsd/Platform.h b/dragonflybsd/Platform.h index 83c14f51..14a249e1 100644 --- a/dragonflybsd/Platform.h +++ b/dragonflybsd/Platform.h @@ -26,11 +26,11 @@ void Platform_setBindings(Htop_Action* keys); extern MeterClass* Platform_meterTypes[]; -int Platform_getUptime(); +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu); diff --git a/freebsd/Platform.h b/freebsd/Platform.h index 1a180551..e58e99d0 100644 --- a/freebsd/Platform.h +++ b/freebsd/Platform.h @@ -25,11 +25,11 @@ void Platform_setBindings(Htop_Action* keys); extern MeterClass* Platform_meterTypes[]; -int Platform_getUptime(); +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu); diff --git a/htop.c b/htop.c index 961ddc41..941c6b83 100644 --- a/htop.c +++ b/htop.c @@ -29,12 +29,12 @@ in the source distribution for its full text. //#link m -static void printVersionFlag() { +static void printVersionFlag(void) { fputs("htop " VERSION "\n", stdout); exit(0); } -static void printHelpFlag() { +static void printHelpFlag(void) { fputs("htop " VERSION "\n" "Released under the GNU GPL.\n\n" "-C --no-color Use a monochrome color scheme\n" diff --git a/linux/Battery.c b/linux/Battery.c index a8784da0..1930880d 100644 --- a/linux/Battery.c +++ b/linux/Battery.c @@ -89,7 +89,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short return total; } -static ACPresence procAcpiCheck() { +static ACPresence procAcpiCheck(void) { ACPresence isOn = AC_ERROR; const char *power_supplyPath = PROCDIR "/acpi/ac_adapter"; DIR *dir = opendir(power_supplyPath); @@ -137,7 +137,7 @@ static ACPresence procAcpiCheck() { return isOn; } -static double Battery_getProcBatData() { +static double Battery_getProcBatData(void) { const unsigned long int totalFull = parseBatInfo("info", 3, 4); if (totalFull == 0) return 0; diff --git a/linux/Platform.h b/linux/Platform.h index 9f0ee7fd..5060ea24 100644 --- a/linux/Platform.h +++ b/linux/Platform.h @@ -25,11 +25,11 @@ void Platform_setBindings(Htop_Action* keys); extern MeterClass* Platform_meterTypes[]; -int Platform_getUptime(); +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu); diff --git a/openbsd/Platform.h b/openbsd/Platform.h index f51d6bc6..9e742bf3 100644 --- a/openbsd/Platform.h +++ b/openbsd/Platform.h @@ -27,11 +27,11 @@ void Platform_setBindings(Htop_Action* keys); extern MeterClass* Platform_meterTypes[]; -int Platform_getUptime(); +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu); diff --git a/solaris/Platform.h b/solaris/Platform.h index dd8614dc..29cc7964 100644 --- a/solaris/Platform.h +++ b/solaris/Platform.h @@ -45,11 +45,11 @@ extern int Platform_numberOfFields; extern char Process_pidFormat[20]; -int Platform_getUptime(); +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu); diff --git a/unsupported/Platform.h b/unsupported/Platform.h index 2a3d768c..fca7fc47 100644 --- a/unsupported/Platform.h +++ b/unsupported/Platform.h @@ -31,11 +31,11 @@ extern char Process_pidFormat[20]; extern ProcessPidColumn Process_pidColumns[]; -int Platform_getUptime(); +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu);