summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-01-06 11:32:59 -0700
committerJens Axboe <axboe@kernel.dk>2021-01-06 11:32:59 -0700
commit59f94d26f98e9c0bc18d4e013f3361c51a2c6b25 (patch)
tree15f20cf8c22cf8ca08520dcabaa971c484690b57 /lib
parente1e6d335854d1a233f167cd443bc2dc71460ec57 (diff)
downloadfio-59f94d26f98e9c0bc18d4e013f3361c51a2c6b25.tar.gz
fio-59f94d26f98e9c0bc18d4e013f3361c51a2c6b25.tar.bz2
Change ARRAY_SIZE to FIO_ARRAY_SIZE
Ensures that we don't clash with external symbols/macros. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'lib')
-rw-r--r--lib/num2str.c8
-rw-r--r--lib/prio_tree.c6
2 files changed, 5 insertions, 9 deletions
diff --git a/lib/num2str.c b/lib/num2str.c
index 726f1c44..3597de2f 100644
--- a/lib/num2str.c
+++ b/lib/num2str.c
@@ -7,8 +7,6 @@
#include "../oslib/asprintf.h"
#include "num2str.h"
-#define ARRAY_SIZE(x) (sizeof((x)) / (sizeof((x)[0])))
-
/**
* num2str() - Cheesy number->string conversion, complete with carry rounding error.
* @num: quantity (e.g., number of blocks, bytes or bits)
@@ -38,7 +36,7 @@ char *num2str(uint64_t num, int maxlen, int base, int pow2, enum n2s_unit units)
char *buf;
compiletime_assert(sizeof(sistr) == sizeof(iecstr), "unit prefix arrays must be identical sizes");
- assert(units < ARRAY_SIZE(unitstr));
+ assert(units < FIO_ARRAY_SIZE(unitstr));
if (pow2)
unitprefix = iecstr;
@@ -69,7 +67,7 @@ char *num2str(uint64_t num, int maxlen, int base, int pow2, enum n2s_unit units)
* Divide by K/Ki until string length of num <= maxlen.
*/
modulo = -1U;
- while (post_index < ARRAY_SIZE(sistr)) {
+ while (post_index < FIO_ARRAY_SIZE(sistr)) {
sprintf(tmp, "%llu", (unsigned long long) num);
if (strlen(tmp) <= maxlen)
break;
@@ -80,7 +78,7 @@ char *num2str(uint64_t num, int maxlen, int base, int pow2, enum n2s_unit units)
post_index++;
}
- if (post_index >= ARRAY_SIZE(sistr))
+ if (post_index >= FIO_ARRAY_SIZE(sistr))
post_index = 0;
/*
diff --git a/lib/prio_tree.c b/lib/prio_tree.c
index d8e1b89a..c4f66a49 100644
--- a/lib/prio_tree.c
+++ b/lib/prio_tree.c
@@ -18,8 +18,6 @@
#include "../compiler/compiler.h"
#include "prio_tree.h"
-#define ARRAY_SIZE(x) (sizeof((x)) / (sizeof((x)[0])))
-
/*
* A clever mix of heap and radix trees forms a radix priority search tree (PST)
* which is useful for storing intervals, e.g, we can consider a vma as a closed
@@ -57,9 +55,9 @@ static void fio_init prio_tree_init(void)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(index_bits_to_maxindex) - 1; i++)
+ for (i = 0; i < FIO_ARRAY_SIZE(index_bits_to_maxindex) - 1; i++)
index_bits_to_maxindex[i] = (1UL << (i + 1)) - 1;
- index_bits_to_maxindex[ARRAY_SIZE(index_bits_to_maxindex) - 1] = ~0UL;
+ index_bits_to_maxindex[FIO_ARRAY_SIZE(index_bits_to_maxindex) - 1] = ~0UL;
}
/*