osl: Introduce volatile columns that need not be freed.
authorAndre Noll <maan@systemlinux.org>
Thu, 1 Nov 2007 23:52:48 +0000 (00:52 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 1 Nov 2007 23:52:48 +0000 (00:52 +0100)
If the new OSL_DONT_FREE flag is given, osl_close_table()
will not try to free such objects.

osl.c
osl.h

diff --git a/osl.c b/osl.c
index 6294fbb..7b4f91f 100644 (file)
--- 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 cb3194b..06fe669 100644 (file)
--- 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;