From 456ebe8f8eee82c467805613f107edd84e73ac26 Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <ambrevar@gmail.com>
Date: Wed, 21 Oct 2015 11:11:17 +0200
Subject: Use ARRAYSIZE macro for non-string array size computation

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
---
 src/pacman/pacman.c | 2 +-
 src/pacman/sync.c   | 2 +-
 src/pacman/util.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/pacman')

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index d777663d..019b0c2e 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1141,7 +1141,7 @@ int main(int argc, char *argv[])
 	new_action.sa_flags = SA_RESTART;
 
 	/* assign our handler to any signals we care about */
-	for(i = 0; i < sizeof(signals) / sizeof(signals[0]); i++) {
+	for(i = 0; i < ARRAYSIZE(signals); i++) {
 		int signal = signals[i];
 		sigaction(signal, NULL, &old_action);
 		if(old_action.sa_handler != SIG_IGN) {
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 3c201999..2a0f4b55 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -228,7 +228,7 @@ static int sync_cleancache(int level)
 				};
 				size_t j;
 
-				for(j = 0; j < sizeof(glob_skips) / sizeof(glob_skips[0]); j++) {
+				for(j = 0; j < ARRAYSIZE(glob_skips); j++) {
 					if(fnmatch(glob_skips[j], ent->d_name, 0) == 0) {
 						delete = 0;
 						break;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 1542f8a2..5f331e82 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1075,7 +1075,7 @@ double humanize_size(off_t bytes, const char target_unit, int precision,
 {
 	static const char *labels[] = {"B", "KiB", "MiB", "GiB",
 		"TiB", "PiB", "EiB", "ZiB", "YiB"};
-	static const int unitcount = sizeof(labels) / sizeof(labels[0]);
+	static const int unitcount = ARRAYSIZE(labels);
 
 	double val = (double)bytes;
 	int index;
-- 
cgit v1.2.3-70-g09d2