@@ -149,7 +149,7 @@ static bool fmt_set_unquoted(struct format_ctx *fctx, const struct rowspec *row,
{
static const char *types[] = { "%llu", "bool" };
- for (int i = 0; i < sizeof(types) / sizeof(types[0]); i++)
+ for (int i = 0; i < ARRAY_SIZE(types); i++)
if (strcmp(types[i], row->fmt) == 0)
return true;
@@ -56,7 +56,7 @@ void test() {
const char *sortby[] = { "size", "id" };
compare_init(&comp, sortit);
- for (i = 0; i < sizeof(sortby) / sizeof(sortby[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(sortby); i++) {
ret = compare_add_sort_key(&comp, sortby[i]);
if (ret < 0) {
printf("ERROR adding sort key %s\n", sortby[i]);
Use ARRAY_SIZE() macro to simplify for loop. Signed-off-by: Integral <integral@archlinuxcn.org> --- common/format-output.c | 2 +- common/sort-utils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)