Some code refactoring

This commit is contained in:
Celine Mercier
2016-11-09 16:48:00 +01:00
parent 359578814b
commit 8f724f4f8e
3 changed files with 39 additions and 8 deletions

View File

@ -660,7 +660,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
return NULL;
}
}
else if ((nb_elements_per_line == 1) && (strcmp(elements_names, column_name) != 0))
else if ((nb_elements_per_line == 1) && (strcmp(elements_names, column_name) != 0)) // TODO Discuss, maybe just make it the column name
{
obidebug(1, "\nCan't create column because the element name does not match the column name");
return NULL;
@ -1126,6 +1126,29 @@ int obi_close_column(OBIDMS_column_p column)
}
int obi_clone_column_indexer(OBIDMS_column_p column)
{
char* new_indexer_name;
new_indexer_name = obi_build_indexer_name((column->header)->name, (column->header)->version);
if (new_indexer_name == NULL)
return -1;
column->indexer = obi_clone_indexer(column->indexer, new_indexer_name); // TODO Need to lock this somehow?
if (column->indexer == NULL)
{
obidebug(1, "\nError cloning a column's indexer to make it writable");
return -1;
}
strcpy((column->header)->indexer_name, new_indexer_name);
free(new_indexer_name);
return 0;
}
int obi_truncate_column(OBIDMS_column_p column) // TODO is it necessary to unmap/remap?
{
size_t file_size;