Cleanup: generate clear_*_table() functions by macro

In analogy to the other table functions, generate these by
a macro as well.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-06-04 20:59:08 +02:00 committed by Dirk Hohndel
parent f4ef1c4bc8
commit 3df32044ee
8 changed files with 18 additions and 31 deletions

View file

@ -91,4 +91,12 @@
return idx; \
}
#define MAKE_CLEAR_TABLE(table_type, array_name, item_name) \
void clear_##table_type(struct table_type *table) \
{ \
for (int i = 0; i < table->nr; i++) \
free_##item_name(table->array_name[i]); \
table->nr = 0; \
}
#endif