From 4a78f4bb928a4fd6b7b0c003ebdea279cf0d319f Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 3 Oct 2020 22:00:27 +0200 Subject: Some more locations for ARRAYSIZE --- freebsd/FreeBSDProcessList.c | 3 ++- freebsd/Platform.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'freebsd') 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 #include @@ -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; -- cgit v1.2.3