From d237ec8d2fc5a697f4fa36832cfd6a037a8db7e6 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 2 Nov 2007 00:52:48 +0100 Subject: [PATCH] osl: Introduce volatile columns that need not be freed. If the new OSL_DONT_FREE flag is given, osl_close_table() will not try to free such objects. --- osl.c | 10 ++++++++-- osl.h | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/osl.c b/osl.c index 6294fbbe..7b4f91f5 100644 --- a/osl.c +++ b/osl.c @@ -994,8 +994,14 @@ static void free_volatile_objects(const struct osl_table *t, for (n = rb_first(&rb_col->rbtree); n; n = rb_next(n)) { struct osl_row *r = get_row_pointer(n, rb_col->rbtree_num); if (flags & OSL_FREE_VOLATILE) - for (j = 0; j < t->num_volatile_columns; j++) - free(r->volatile_objects[j].data); + FOR_EACH_VOLATILE_COLUMN(j, t, cd) { + if (cd->storage_flags & OSL_DONT_FREE) + continue; + free(r->volatile_objects[ + t->columns[j].volatile_num].data); + } +// for (j = 0; j < t->num_volatile_columns; j++) +// free(r->volatile_objects[j].data); free(r->volatile_objects); } } diff --git a/osl.h b/osl.h index cb3194be..06fe669e 100644 --- a/osl.h +++ b/osl.h @@ -58,7 +58,9 @@ enum osl_storage_flags { /** The data for this column will have constant size. */ OSL_FIXED_SIZE = 2, /** All values of this column will be different. */ - OSL_UNIQUE = 4 + OSL_UNIQUE = 4, + /** Do not free the data for this column (\p OSL_NO_STORAGE). */ + OSL_DONT_FREE = 8 }; struct osl_table; -- 2.39.5