summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-10-03 22:00:27 +0200
committercgzones <cgzones@googlemail.com>2020-10-08 15:37:03 +0200
commit4a78f4bb928a4fd6b7b0c003ebdea279cf0d319f (patch)
tree12660b02902315c4036085d428838ad062acf339
parent2970cae5436c1e38a98661da3d59c3371051d606 (diff)
Some more locations for ARRAYSIZE
-rw-r--r--darwin/Platform.c3
-rw-r--r--dragonflybsd/DragonFlyBSDProcessList.c3
-rw-r--r--dragonflybsd/Platform.c3
-rw-r--r--freebsd/FreeBSDProcessList.c3
-rw-r--r--freebsd/Platform.c3
-rw-r--r--openbsd/OpenBSDProcessList.c3
-rw-r--r--openbsd/Platform.c3
-rw-r--r--solaris/Platform.c3
-rw-r--r--unsupported/Platform.c3
9 files changed, 18 insertions, 9 deletions
diff --git a/darwin/Platform.c b/darwin/Platform.c
index 4d8ede32..99787a27 100644
--- a/darwin/Platform.c
+++ b/darwin/Platform.c
@@ -7,6 +7,7 @@ in the source distribution for its full text.
*/
#include "Platform.h"
+#include "Macros.h"
#include "CPUMeter.h"
#include "MemoryMeter.h"
#include "SwapMeter.h"
@@ -63,7 +64,7 @@ const SignalItem Platform_signals[] = {
{ .name = "31 SIGUSR2", .number = 31 },
};
-const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
+const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
ProcessFieldData Process_fields[] = {
[0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, },
diff --git a/dragonflybsd/DragonFlyBSDProcessList.c b/dragonflybsd/DragonFlyBSDProcessList.c
index 1c10a412..87f16069 100644
--- a/dragonflybsd/DragonFlyBSDProcessList.c
+++ b/dragonflybsd/DragonFlyBSDProcessList.c
@@ -9,6 +9,7 @@ in the source distribution for its full text.
#include "ProcessList.h"
#include "DragonFlyBSDProcessList.h"
#include "DragonFlyBSDProcess.h"
+#include "Macros.h"
#include <unistd.h>
#include <stdlib.h>
@@ -253,7 +254,7 @@ static inline void DragonFlyBSDProcessList_scanMemoryInfo(ProcessList* pl) {
//pl->freeMem *= pageSizeKb;
struct kvm_swap swap[16];
- int nswap = kvm_getswapinfo(dfpl->kd, swap, sizeof(swap)/sizeof(swap[0]), 0);
+ int nswap = kvm_getswapinfo(dfpl->kd, swap, ARRAYSIZE(swap), 0);
pl->totalSwap = 0;
pl->usedSwap = 0;
for (int i = 0; i < nswap; i++) {
diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c
index 21ebc40a..6eb1e99c 100644
--- a/dragonflybsd/Platform.c
+++ b/dragonflybsd/Platform.c
@@ -7,6 +7,7 @@ in the source distribution for its full text.
*/
#include "Platform.h"
+#include "Macros.h"
#include "Meter.h"
#include "CPUMeter.h"
#include "MemoryMeter.h"
@@ -71,7 +72,7 @@ const SignalItem Platform_signals[] = {
{ .name = "33 SIGLIBRT", .number = 33 },
};
-const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
+const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
void Platform_setBindings(Htop_Action* keys) {
(void) keys;
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c
index f9377a2d..71f87e16 100644
--- a/freebsd/FreeBSDProcessList.c
+++ b/freebsd/FreeBSDProcessList.c
@@ -11,6 +11,7 @@ in the source distribution for its full text.
#include "FreeBSDProcess.h"
#include "zfs/ZfsArcStats.h"
#include "zfs/openzfs_sysctl.h"
+#include "Macros.h"
#include <unistd.h>
#include <stdlib.h>
@@ -293,7 +294,7 @@ static inline void FreeBSDProcessList_scanMemoryInfo(ProcessList* pl) {
//pl->freeMem *= pageSizeKb;
struct kvm_swap swap[16];
- int nswap = kvm_getswapinfo(fpl->kd, swap, sizeof(swap)/sizeof(swap[0]), 0);
+ int nswap = kvm_getswapinfo(fpl->kd, swap, ARRAYSIZE(swap), 0);
pl->totalSwap = 0;
pl->usedSwap = 0;
for (int i = 0; i < nswap; i++) {
diff --git a/freebsd/Platform.c b/freebsd/Platform.c
index 9c91de15..2288d2f2 100644
--- a/freebsd/Platform.c
+++ b/freebsd/Platform.c
@@ -6,6 +6,7 @@ in the source distribution for its full text.
*/
#include "Platform.h"
+#include "Macros.h"
#include "Meter.h"
#include "CPUMeter.h"
#include "MemoryMeter.h"
@@ -72,7 +73,7 @@ const SignalItem Platform_signals[] = {
{ .name = "33 SIGLIBRT", .number = 33 },
};
-const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
+const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
void Platform_setBindings(Htop_Action* keys) {
(void) keys;
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index 9d1367e7..c3ba763a 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -10,6 +10,7 @@ in the source distribution for its full text.
#include "ProcessList.h"
#include "OpenBSDProcessList.h"
#include "OpenBSDProcess.h"
+#include "Macros.h"
#include <err.h>
#include <errno.h>
@@ -118,7 +119,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
pl->cachedMem *= PAGE_SIZE_KB;
struct kvm_swap swap[16];
- int nswap = kvm_getswapinfo(opl->kd, swap, sizeof(swap)/sizeof(swap[0]), 0);
+ int nswap = kvm_getswapinfo(opl->kd, swap, ARRAYSIZE(swap), 0);
pl->totalSwap = 0;
pl->usedSwap = 0;
for (int i = 0; i < nswap; i++) {
diff --git a/openbsd/Platform.c b/openbsd/Platform.c
index 02a821e7..4c2ebdfb 100644
--- a/openbsd/Platform.c
+++ b/openbsd/Platform.c
@@ -7,6 +7,7 @@ in the source distribution for its full text.
*/
#include "Platform.h"
+#include "Macros.h"
#include "Meter.h"
#include "CPUMeter.h"
#include "MemoryMeter.h"
@@ -84,7 +85,7 @@ const SignalItem Platform_signals[] = {
{ .name = "32 SIGTHR", .number = 32 },
};
-const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
+const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
void Platform_setBindings(Htop_Action* keys) {
(void) keys;
diff --git a/solaris/Platform.c b/solaris/Platform.c
index e1243bfa..ef0d4123 100644
--- a/solaris/Platform.c
+++ b/solaris/Platform.c
@@ -8,6 +8,7 @@ in the source distribution for its full text.
*/
#include "Platform.h"
+#include "Macros.h"
#include "Meter.h"
#include "CPUMeter.h"
#include "MemoryMeter.h"
@@ -83,7 +84,7 @@ const SignalItem Platform_signals[] = {
{ .name = "41 SIGINFO", .number = 41 },
};
-const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
+const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
ProcessField Platform_defaultFields[] = { PID, LWPID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
diff --git a/unsupported/Platform.c b/unsupported/Platform.c
index 304989ee..b7fdf17d 100644
--- a/unsupported/Platform.c
+++ b/unsupported/Platform.c
@@ -9,6 +9,7 @@ in the source distribution for its full text.
#include <math.h>
#include "Platform.h"
+#include "Macros.h"
#include "CPUMeter.h"
#include "MemoryMeter.h"
#include "SwapMeter.h"
@@ -25,7 +26,7 @@ const SignalItem Platform_signals[] = {
{ .name = " 0 Cancel", .number = 0 },
};
-const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
+const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };

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