From 49b8810a7607a490675b49974e5a1e4814c5dbfb Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Sat, 13 Jun 2020 21:47:03 +0200 Subject: [PATCH] C: made indexer opening/closing cleaner --- src/obidmscolumn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/obidmscolumn.c b/src/obidmscolumn.c index ac6d1ba..960e887 100644 --- a/src/obidmscolumn.c +++ b/src/obidmscolumn.c @@ -1350,6 +1350,8 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms, } strncpy(header->indexer_name, final_indexer_name, INDEXER_MAX_NAME); } + else + new_column->indexer = NULL; // Fill the data with NA values obi_ini_to_NA_values(new_column, 0, nb_lines); @@ -1558,6 +1560,8 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms, return NULL; } } + else + column->indexer = NULL; if (close(column_file_descriptor) < 0) { @@ -1694,7 +1698,7 @@ int obi_close_column(OBIDMS_column_p column) ret_val = -1; // If it's a tuple column or the data type is OBI_STR, OBI_SEQ or OBI_QUAL, the associated indexer is closed - if (((column->header)->tuples) || (((column->header)->returned_data_type == OBI_STR) || ((column->header)->returned_data_type == OBI_SEQ) || ((column->header)->returned_data_type == OBI_QUAL))) + if ((column->indexer) != NULL) if (obi_close_indexer(column->indexer) < 0) ret_val = -1;