Use strict function prototypes

int foo(); declares a function taking any number of arguments.
This commit is contained in:
Christian Göttsche 2020-09-08 14:28:34 +02:00 committed by cgzones
parent 7107d1db0b
commit c3952e7c20
16 changed files with 32 additions and 32 deletions

View File

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

View File

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

12
CRT.h
View File

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

View File

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

View File

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

View File

@ -12,6 +12,6 @@ typedef struct SignalItem_ {
int number;
} SignalItem;
Panel* SignalsPanel_new();
Panel* SignalsPanel_new(void);
#endif

View File

@ -13,7 +13,7 @@ typedef struct UsersTable_ {
Hashtable* users;
} UsersTable;
UsersTable* UsersTable_new();
UsersTable* UsersTable_new(void);
void UsersTable_delete(UsersTable* this);

View File

@ -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[];

View File

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

View File

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

4
htop.c
View File

@ -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"

View File

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

View File

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

View File

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

View File

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

View File

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