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>
int BatteryMeter_attributes[] = {
static const int BatteryMeter_attributes[] = {
BATTERY
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,11 +11,15 @@ in the source distribution for its full text.
#include "Platform.h"
int LoadAverageMeter_attributes[] = {
LOAD_AVERAGE_ONE, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_FIFTEEN
static const int LoadAverageMeter_attributes[] = {
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) {
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"
extern int LoadAverageMeter_attributes[];
extern int LoadMeter_attributes[];
extern MeterClass LoadAverageMeter_class;
extern MeterClass LoadMeter_class;

View File

@ -17,8 +17,10 @@ in the source distribution for its full text.
#include <assert.h>
int MemoryMeter_attributes[] = {
MEMORY_USED, MEMORY_BUFFERS, MEMORY_CACHE
static const int MemoryMeter_attributes[] = {
MEMORY_USED,
MEMORY_BUFFERS,
MEMORY_CACHE
};
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"
extern int MemoryMeter_attributes[];
extern MeterClass MemoryMeter_class;
#endif

View File

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

View File

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

View File

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

View File

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

View File

@ -11,8 +11,11 @@ in the source distribution for its full text.
#include "CRT.h"
int TasksMeter_attributes[] = {
CPU_SYSTEM, PROCESS_THREAD, PROCESS, TASKS_RUNNING
static const int TasksMeter_attributes[] = {
CPU_SYSTEM,
PROCESS_THREAD,
PROCESS,
TASKS_RUNNING
};
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"
extern int TasksMeter_attributes[];
extern MeterClass TasksMeter_class;
#endif

View File

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

View File

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