diff options
Diffstat (limited to 'ctrl/facemgr/src/util/set.h')
-rw-r--r-- | ctrl/facemgr/src/util/set.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ctrl/facemgr/src/util/set.h b/ctrl/facemgr/src/util/set.h index 0dad17423..b9d66c16e 100644 --- a/ctrl/facemgr/src/util/set.h +++ b/ctrl/facemgr/src/util/set.h @@ -96,7 +96,19 @@ NAME ## _initialize(NAME ## _t * set) \ } \ \ int \ -NAME ## _finalize(NAME ## _t * set) { return 0; } \ +NAME ## _finalize(NAME ## _t * set) \ +{ \ + T * array; \ + int n = NAME ## _get_array(set, &array); \ + if (n < 0) \ + return -1; \ + for (unsigned i = 0; i < n; i++) { \ + T element = array[i]; \ + NAME ## _remove(set, element, NULL); \ + } \ + free(array); \ + return 0; \ +} \ \ NAME ## _t * \ NAME ## _create() \ |