X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=osl.c;h=e31811b9c57eb0d897aee1c92c41b72cb35a97cc;hp=67160d2b3bb14539edf1cd5f8b886d55940d0f63;hb=cb73d5fa58cec287978337f5e186fff52bccd252;hpb=83466429374f5036d9872f9905837f547967b0d5 diff --git a/osl.c b/osl.c index 67160d2..e31811b 100644 --- a/osl.c +++ b/osl.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 Andre Noll + * Copyright (C) 2007-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -13,7 +13,14 @@ #include "util.h" #include "osl_core.h" -/* Taken from Drepper: How to write shared libraries, Appendix B. */ +/* + * Taken from Drepper: How to write shared libraries, Appendix B. + * + * The main reason for this rather fancy implementation of strerror() is to + * avoid having an array of pointers. This is desirable because initialized + * pointer variables increase the startup time of the library due to the + * processing of relocations. + */ #include #define MSGSTRFIELD(line) MSGSTRFIELD1(line) #define MSGSTRFIELD1(line) str##line @@ -277,6 +284,9 @@ int init_table_structure(const struct osl_table_description *desc, ret = -E_OSL_BAD_STORAGE_FLAGS; if (st == OSL_DISK_STORAGE && sf & OSL_RBTREE) goto err; + if ((sf & OSL_RBTREE) && !(sf & OSL_UNIQUE)) + WARNING_LOG("invalid storage flags for column %s: " + "OSL_RBTREE && !OSL_UNIQUE\n", cd->name); ret = -E_OSL_BAD_STORAGE_SIZE; if (sf & OSL_FIXED_SIZE && !cd->data_size) goto err; @@ -516,7 +526,7 @@ static int create_table_index(struct osl_table *t) strcpy(buf + offset + IDX_CD_NAME, cd->name); offset += index_column_description_size(cd->name); } - assert(offset = size); + assert(offset == size); filename = index_filename(t->desc); if (filename) ret = write_file(filename, buf, size); @@ -1569,7 +1579,8 @@ __export int osl_update_object(struct osl_table *t, const struct osl_row *r, } remove_rb_node(t, col_num, r); if (cd->storage_type == OSL_NO_STORAGE) { /* TODO: If fixed size, reuse object? */ - free(r->volatile_objects[col->volatile_num].data); + if (!(cd->storage_flags & OSL_DONT_FREE)) + free(r->volatile_objects[col->volatile_num].data); r->volatile_objects[col->volatile_num] = *obj; } else if (cd->storage_type == OSL_DISK_STORAGE) { char *ds_name; @@ -1698,6 +1709,7 @@ __export int osl_get_nth_row(const struct osl_table *t, unsigned col_num, unsigned num_rows; int ret; + *result = NULL; if (n == 0) return -E_OSL_RB_KEY_NOT_FOUND; ret = osl_get_num_rows(t, &num_rows);