From 4a3ad75efa4a4ac5ad1a65aec5d9cfb523ebffe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 7 Apr 2021 16:55:27 +0200 Subject: [PATCH] shared/format-table: rework loop Not a big difference, but I think it's a bit nicer this way. --- src/shared/format-table.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/shared/format-table.c b/src/shared/format-table.c index 6bbc8bd509..8d816f4ec6 100644 --- a/src/shared/format-table.c +++ b/src/shared/format-table.c @@ -783,19 +783,17 @@ int table_update(Table *t, TableCell *cell, TableDataType type, const void *data } int table_add_many_internal(Table *t, TableDataType first_type, ...) { - TableDataType type; - va_list ap; TableCell *last_cell = NULL; + va_list ap; int r; assert(t); assert(first_type >= 0); assert(first_type < _TABLE_DATA_TYPE_MAX); - type = first_type; - va_start(ap, first_type); - for (;;) { + + for (TableDataType type = first_type;; type = va_arg(ap, TableDataType)) { const void *data; union { uint64_t size; @@ -1048,8 +1046,6 @@ int table_add_many_internal(Table *t, TableDataType first_type, ...) { va_end(ap); return r; } - - type = va_arg(ap, TableDataType); } }