summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-28 12:23:07 +0200
committercgzones <cgzones@googlemail.com>2020-09-29 10:44:42 +0200
commit6db2d52261d676a378625a24c307fa718025bc5f (patch)
treeaee3ae4218543b0c5b7abc8b04b93b2c3dcbb33b
parent843949131aa75312086bea6a50408e09d82f5209 (diff)
Covert Meter attributes to file-local constant arrays
-rw-r--r--BatteryMeter.c2
-rw-r--r--BatteryMeter.h2
-rw-r--r--CPUMeter.c11
-rw-r--r--CPUMeter.h2
-rw-r--r--ClockMeter.c2
-rw-r--r--ClockMeter.h2
-rw-r--r--HostnameMeter.c2
-rw-r--r--HostnameMeter.h2
-rw-r--r--LoadAverageMeter.c10
-rw-r--r--LoadAverageMeter.h4
-rw-r--r--MemoryMeter.c6
-rw-r--r--MemoryMeter.h2
-rw-r--r--Meter.c2
-rw-r--r--Meter.h2
-rw-r--r--SwapMeter.c2
-rw-r--r--SwapMeter.h2
-rw-r--r--TasksMeter.c7
-rw-r--r--TasksMeter.h2
-rw-r--r--UptimeMeter.c2
-rw-r--r--UptimeMeter.h2
20 files changed, 31 insertions, 37 deletions
diff --git a/BatteryMeter.c b/BatteryMeter.c
index 0ae2834c..733298a1 100644
--- a/BatteryMeter.c
+++ b/BatteryMeter.c
@@ -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
};
diff --git a/BatteryMeter.h b/BatteryMeter.h
index 658cd3f9..b67754d3 100644
--- a/BatteryMeter.h
+++ b/BatteryMeter.h
@@ -17,8 +17,6 @@ typedef enum ACPresence_ {
AC_ERROR
} ACPresence;
-extern int BatteryMeter_attributes[];
-
extern MeterClass BatteryMeter_class;
#endif
diff --git a/CPUMeter.c b/CPUMeter.c
index c5e27124..44ef1add 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -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) {
diff --git a/CPUMeter.h b/CPUMeter.h
index 62a1ddc3..6244c42a 100644
--- a/CPUMeter.h
+++ b/CPUMeter.h
@@ -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;
diff --git a/ClockMeter.c b/ClockMeter.c
index 3168b3e9..6ad191a2 100644
--- a/ClockMeter.c
+++ b/ClockMeter.c
@@ -12,7 +12,7 @@ in the source distribution for its full text.
#include <time.h>
-int ClockMeter_attributes[] = {
+static const int ClockMeter_attributes[] = {
CLOCK
};
diff --git a/ClockMeter.h b/ClockMeter.h
index e888d585..bb6881ae 100644
--- a/ClockMeter.h
+++ b/ClockMeter.h
@@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h"
-extern int ClockMeter_attributes[];
-
extern MeterClass ClockMeter_class;
#endif
diff --git a/HostnameMeter.c b/HostnameMeter.c
index 60bd8125..edb23358 100644
--- a/HostnameMeter.c
+++ b/HostnameMeter.c
@@ -12,7 +12,7 @@ in the source distribution for its full text.
#include <unistd.h>
-int HostnameMeter_attributes[] = {
+static const int HostnameMeter_attributes[] = {
HOSTNAME
};
diff --git a/HostnameMeter.h b/HostnameMeter.h
index ecfab1aa..152100d0 100644
--- a/HostnameMeter.h
+++ b/HostnameMeter.h
@@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h"
-extern int HostnameMeter_attributes[];
-
extern MeterClass HostnameMeter_class;
#endif
diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c
index db397b6c..3f75aeca 100644
--- a/LoadAverageMeter.c
+++ b/LoadAverageMeter.c
@@ -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]);
diff --git a/LoadAverageMeter.h b/LoadAverageMeter.h
index 83d3c8f5..5ac771a4 100644
--- a/LoadAverageMeter.h
+++ b/LoadAverageMeter.h
@@ -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;
diff --git a/MemoryMeter.c b/MemoryMeter.c
index 91f75b9c..cac0da72 100644
--- a/MemoryMeter.c
+++ b/MemoryMeter.c
@@ -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) {
diff --git a/MemoryMeter.h b/MemoryMeter.h
index 771aa735..f8df247d 100644
--- a/MemoryMeter.h
+++ b/MemoryMeter.h
@@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h"
-extern int MemoryMeter_attributes[];
-
extern MeterClass MemoryMeter_class;
#endif
diff --git a/Meter.c b/Meter.c
index d144b5b8..c453b4bc 100644
--- a/Meter.c
+++ b/Meter.c
@@ -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
};
diff --git a/Meter.h b/Meter.h
index c4d00396..03b49608 100644
--- a/Meter.h
+++ b/Meter.h
@@ -105,8 +105,6 @@ ListItem* Meter_toListItem(Meter* this, bool moving);
extern MeterMode* Meter_modes[];
-extern int BlankMeter_attributes[];
-
extern MeterClass BlankMeter_class;
#endif
diff --git a/SwapMeter.c b/SwapMeter.c
index fcf450ee..ae4d4097 100644
--- a/SwapMeter.c
+++ b/SwapMeter.c
@@ -17,7 +17,7 @@ in the source distribution for its full text.
#include <assert.h>
-int SwapMeter_attributes[] = {
+static const int SwapMeter_attributes[] = {
SWAP
};
diff --git a/SwapMeter.h b/SwapMeter.h
index 69a5855f..2ba596cb 100644
--- a/SwapMeter.h
+++ b/SwapMeter.h
@@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h"
-extern int SwapMeter_attributes[];
-
extern MeterClass SwapMeter_class;
#endif
diff --git a/TasksMeter.c b/TasksMeter.c
index 0b37ab27..45d3ba15 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -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) {
diff --git a/TasksMeter.h b/TasksMeter.h
index bdb62a73..82ddc081 100644
--- a/TasksMeter.h
+++ b/TasksMeter.h
@@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h"
-extern int TasksMeter_attributes[];
-
extern MeterClass TasksMeter_class;
#endif
diff --git a/UptimeMeter.c b/UptimeMeter.c
index da1c9fd0..0a9589a0 100644
--- a/UptimeMeter.c
+++ b/UptimeMeter.c
@@ -10,7 +10,7 @@ in the source distribution for its full text.
#include "CRT.h"
-int UptimeMeter_attributes[] = {
+static const int UptimeMeter_attributes[] = {
UPTIME
};
diff --git a/UptimeMeter.h b/UptimeMeter.h
index 5fa1e931..cac51aad 100644
--- a/UptimeMeter.h
+++ b/UptimeMeter.h
@@ -9,8 +9,6 @@ in the source distribution for its full text.
#include "Meter.h"
-extern int UptimeMeter_attributes[];
-
extern MeterClass UptimeMeter_class;
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy