From: Andre Noll Date: Thu, 1 Nov 2007 23:52:48 +0000 (+0100) Subject: osl: Introduce volatile columns that need not be freed. X-Git-Tag: v0.3.0~134 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=d237ec8d2fc5a697f4fa36832cfd6a037a8db7e6;ds=sidebyside 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. --- 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;