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

@ -27,7 +27,6 @@
int obi_column_set_obistr_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx, const char* value)
{
index_t idx;
char* new_indexer_name;
if (obi_column_prepare_to_set_value(column, line_nb) < 0)
return -1;
@ -44,14 +43,9 @@ int obi_column_set_obistr_with_elt_idx(OBIDMS_column_p column, index_t line_nb,
{
if (obi_errno == OBI_READ_ONLY_INDEXER_ERROR)
{
// TODO PUT IN A COLUMN FUNCTION
// If the error is that the indexer is read-only, clone it
new_indexer_name = obi_build_indexer_name((column->header)->name, (column->header)->version);
if (new_indexer_name == NULL)
if (obi_clone_column_indexer(column) < 0)
return -1;
column->indexer = obi_clone_indexer(column->indexer, new_indexer_name); // TODO Need to lock this somehow?
strcpy((column->header)->indexer_name, new_indexer_name);
free(new_indexer_name);
obi_set_errno(0);
// Add the value in the new indexer