diff options
Diffstat (limited to 'core/table.h')
-rw-r--r-- | core/table.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/table.h b/core/table.h index cf0be3bae..0f168f4bc 100644 --- a/core/table.h +++ b/core/table.h @@ -99,4 +99,15 @@ table->nr = 0; \ } +/* Move data of one table to the other - source table is empty after call. */ +#define MAKE_MOVE_TABLE(table_type, array_name) \ + void move_##table_type(struct table_type *src, struct table_type *dst) \ + { \ + clear_##table_type(dst); \ + free(dst->array_name); \ + *dst = *src; \ + src->nr = src->allocated = 0; \ + src->array_name = NULL; \ + } + #endif |