C: made indexer opening/closing cleaner

This commit is contained in:
Celine Mercier
2020-06-13 21:47:03 +02:00
parent 7a39df54c0
commit 49b8810a76

View File

@ -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;