Covert Meter attributes to file-local constant arrays

This commit is contained in:
Christian Göttsche 2020-09-28 12:23:07 +02:00 committed by cgzones
parent 843949131a
commit 6db2d52261
20 changed files with 31 additions and 37 deletions

View File

@ -20,7 +20,7 @@ This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com).
#include <stdlib.h> #include <stdlib.h>
int BatteryMeter_attributes[] = { static const int BatteryMeter_attributes[] = {
BATTERY BATTERY
}; };

View File

@ -17,8 +17,6 @@ typedef enum ACPresence_ {
AC_ERROR AC_ERROR
} ACPresence; } ACPresence;
extern int BatteryMeter_attributes[];
extern MeterClass BatteryMeter_class; extern MeterClass BatteryMeter_class;
#endif #endif

View File

@ -16,8 +16,15 @@ in the source distribution for its full text.
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
int CPUMeter_attributes[] = { static const int CPUMeter_attributes[] = {
CPU_NICE, CPU_NORMAL, CPU_SYSTEM, CPU_IRQ, CPU_SOFTIRQ, CPU_STEAL, CPU_GUEST, CPU_IOWAIT CPU_NICE,
CPU_NORMAL,
CPU_SYSTEM,
CPU_IRQ,
CPU_SOFTIRQ,
CPU_STEAL,
CPU_GUEST,
CPU_IOWAIT
}; };
static void CPUMeter_init(Meter* this) { static void CPUMeter_init(Meter* this) {

View File

@ -22,8 +22,6 @@ typedef enum {
CPU_METER_ITEMCOUNT = 9, // number of entries in this enum CPU_METER_ITEMCOUNT = 9, // number of entries in this enum
} CPUMeterValues; } CPUMeterValues;
extern int CPUMeter_attributes[];
extern MeterClass CPUMeter_class; extern MeterClass CPUMeter_class;
extern MeterClass AllCPUsMeter_class; extern MeterClass AllCPUsMeter_class;

View File

@ -12,7 +12,7 @@ in the source distribution for its full text.
#include <time.h> #include <time.h>
int ClockMeter_attributes[] = { static const int ClockMeter_attributes[] = {
CLOCK CLOCK
}; };

View File

@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern int ClockMeter_attributes[];
extern MeterClass ClockMeter_class; extern MeterClass ClockMeter_class;
#endif #endif

View File

@ -12,7 +12,7 @@ in the source distribution for its full text.
#include <unistd.h> #include <unistd.h>
int HostnameMeter_attributes[] = { static const int HostnameMeter_attributes[] = {
HOSTNAME HOSTNAME
}; };

View File

@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern int HostnameMeter_attributes[];
extern MeterClass HostnameMeter_class; extern MeterClass HostnameMeter_class;
#endif #endif

View File

@ -11,11 +11,15 @@ in the source distribution for its full text.
#include "Platform.h" #include "Platform.h"
int LoadAverageMeter_attributes[] = { static const int LoadAverageMeter_attributes[] = {
LOAD_AVERAGE_ONE, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_FIFTEEN LOAD_AVERAGE_ONE,
LOAD_AVERAGE_FIVE,
LOAD_AVERAGE_FIFTEEN
}; };
int LoadMeter_attributes[] = { LOAD }; static const int LoadMeter_attributes[] = {
LOAD
};
static void LoadAverageMeter_updateValues(Meter* this, char* buffer, int size) { static void LoadAverageMeter_updateValues(Meter* this, char* buffer, int size) {
Platform_getLoadAverage(&this->values[0], &this->values[1], &this->values[2]); Platform_getLoadAverage(&this->values[0], &this->values[1], &this->values[2]);

View File

@ -9,10 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern int LoadAverageMeter_attributes[];
extern int LoadMeter_attributes[];
extern MeterClass LoadAverageMeter_class; extern MeterClass LoadAverageMeter_class;
extern MeterClass LoadMeter_class; extern MeterClass LoadMeter_class;

View File

@ -17,8 +17,10 @@ in the source distribution for its full text.
#include <assert.h> #include <assert.h>
int MemoryMeter_attributes[] = { static const int MemoryMeter_attributes[] = {
MEMORY_USED, MEMORY_BUFFERS, MEMORY_CACHE MEMORY_USED,
MEMORY_BUFFERS,
MEMORY_CACHE
}; };
static void MemoryMeter_updateValues(Meter* this, char* buffer, int size) { static void MemoryMeter_updateValues(Meter* this, char* buffer, int size) {

View File

@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern int MemoryMeter_attributes[];
extern MeterClass MemoryMeter_class; extern MeterClass MemoryMeter_class;
#endif #endif

View File

@ -433,7 +433,7 @@ static void BlankMeter_display(Object* cast, RichString* out) {
RichString_prune(out); RichString_prune(out);
} }
int BlankMeter_attributes[] = { static const int BlankMeter_attributes[] = {
DEFAULT_COLOR DEFAULT_COLOR
}; };

View File

@ -105,8 +105,6 @@ ListItem* Meter_toListItem(Meter* this, bool moving);
extern MeterMode* Meter_modes[]; extern MeterMode* Meter_modes[];
extern int BlankMeter_attributes[];
extern MeterClass BlankMeter_class; extern MeterClass BlankMeter_class;
#endif #endif

View File

@ -17,7 +17,7 @@ in the source distribution for its full text.
#include <assert.h> #include <assert.h>
int SwapMeter_attributes[] = { static const int SwapMeter_attributes[] = {
SWAP SWAP
}; };

View File

@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern int SwapMeter_attributes[];
extern MeterClass SwapMeter_class; extern MeterClass SwapMeter_class;
#endif #endif

View File

@ -11,8 +11,11 @@ in the source distribution for its full text.
#include "CRT.h" #include "CRT.h"
int TasksMeter_attributes[] = { static const int TasksMeter_attributes[] = {
CPU_SYSTEM, PROCESS_THREAD, PROCESS, TASKS_RUNNING CPU_SYSTEM,
PROCESS_THREAD,
PROCESS,
TASKS_RUNNING
}; };
static void TasksMeter_updateValues(Meter* this, char* buffer, int len) { static void TasksMeter_updateValues(Meter* this, char* buffer, int len) {

View File

@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern int TasksMeter_attributes[];
extern MeterClass TasksMeter_class; extern MeterClass TasksMeter_class;
#endif #endif

View File

@ -10,7 +10,7 @@ in the source distribution for its full text.
#include "CRT.h" #include "CRT.h"
int UptimeMeter_attributes[] = { static const int UptimeMeter_attributes[] = {
UPTIME UPTIME
}; };

View File

@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern int UptimeMeter_attributes[];
extern MeterClass UptimeMeter_class; extern MeterClass UptimeMeter_class;
#endif #endif