Commit 92f1e068 authored by Nicolas Denoyelle's avatar Nicolas Denoyelle

cosmetique

parent fb6a4ec2
...@@ -152,3 +152,4 @@ error: ...@@ -152,3 +152,4 @@ error:
excit_free(results[i]); excit_free(results[i]);
return err; return err;
} }
...@@ -31,8 +31,7 @@ static void tleaf_it_free(excit_t it) ...@@ -31,8 +31,7 @@ static void tleaf_it_free(excit_t it)
free(data_it->order); free(data_it->order);
if (data_it->buf != NULL) if (data_it->buf != NULL)
free(data_it->buf); free(data_it->buf);
if (data_it->levels) excit_free(data_it->levels);
excit_free(data_it->levels);
} }
static int excit_tleaf_init_with_it(excit_t it, static int excit_tleaf_init_with_it(excit_t it,
...@@ -203,18 +202,15 @@ static int tleaf_it_copy(excit_t dst_it, const excit_t src_it) ...@@ -203,18 +202,15 @@ static int tleaf_it_copy(excit_t dst_it, const excit_t src_it)
} }
/* dst is not initialized (anymore) */ /* dst is not initialized (anymore) */
excit_t levels = excit_alloc(EXCIT_PRODUCT); excit_t levels = excit_dup(src->levels);
if (levels == NULL)
return -EXCIT_ENOMEM;
err = src_it->func_table->copy(levels, src->levels); if (levels == NULL) {
if (err != EXCIT_SUCCESS) err = -EXCIT_ENOMEM;
goto error_with_levels; goto error;
}
err = err = excit_tleaf_init_with_it(dst_it, src->depth + 1, src->arities,
excit_tleaf_init_with_it(dst_it, src->depth + 1, src->arities, TLEAF_POLICY_USER, src->order, levels);
TLEAF_POLICY_USER, src->order, levels);
if (err != EXCIT_SUCCESS) if (err != EXCIT_SUCCESS)
goto error_with_levels; goto error_with_levels;
...@@ -222,6 +218,7 @@ static int tleaf_it_copy(excit_t dst_it, const excit_t src_it) ...@@ -222,6 +218,7 @@ static int tleaf_it_copy(excit_t dst_it, const excit_t src_it)
error_with_levels: error_with_levels:
excit_free(levels); excit_free(levels);
error:
return err; return err;
} }
......
...@@ -44,7 +44,7 @@ void test_tleaf_iterator(void) ...@@ -44,7 +44,7 @@ void test_tleaf_iterator(void)
for (i = 0; i < TLEAF_NSPLIT; i++) for (i = 0; i < TLEAF_NSPLIT; i++)
split[i] = excit_alloc(EXCIT_TLEAF); split[i] = excit_alloc(EXCIT_TLEAF);
err = tleaf_it_split_at_level(it, 2, TLEAF_NSPLIT, split); err = tleaf_it_split(it, 2, TLEAF_NSPLIT, split);
assert(err == EXCIT_SUCCESS); assert(err == EXCIT_SUCCESS);
err = excit_rewind(split[1]); err = excit_rewind(split[1]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment