summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-02-17 11:16:01 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-02-17 11:16:01 +0000
commit356a798915aa00a5f9a685bec2d6f4f8b29d359e (patch)
treed511ae8ccc75dcd8fdcc90aa72f6f06a79921355
parent0374da45984c07f1dc3a3ad12c8834b7355580c7 (diff)
eina: fix forgotten initialization of count during eina_list_split_list.
SVN revision: 68067
-rw-r--r--ChangeLog4
-rw-r--r--src/lib/eina_list.c1
-rw-r--r--src/tests/eina_test_list.c40
3 files changed, 45 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ac64c95..1e904c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,3 +39,7 @@
392011-12-28 Cedric Bail 392011-12-28 Cedric Bail
40 40
41 * Fix NONNULL argument for eina_hash_find. 41 * Fix NONNULL argument for eina_hash_find.
42
432012-02-17 Cedric Bail
44
45 * Fix forgotten initialization of eina list count during eina_list_split_list.
diff --git a/src/lib/eina_list.c b/src/lib/eina_list.c
index f3a4710..b34d2d6 100644
--- a/src/lib/eina_list.c
+++ b/src/lib/eina_list.c
@@ -1633,6 +1633,7 @@ eina_list_split_list(Eina_List *list, Eina_List *relative, Eina_List **right)
1633 next->prev = NULL; 1633 next->prev = NULL;
1634 next->accounting = _eina_list_mempool_accounting_new(next); 1634 next->accounting = _eina_list_mempool_accounting_new(next);
1635 next->accounting->last = list->accounting->last; 1635 next->accounting->last = list->accounting->last;
1636 next->accounting->count = 0;
1636 *right = next; 1637 *right = next;
1637 1638
1638 itr = next; 1639 itr = next;
diff --git a/src/tests/eina_test_list.c b/src/tests/eina_test_list.c
index 6e08847..ce70d03 100644
--- a/src/tests/eina_test_list.c
+++ b/src/tests/eina_test_list.c
@@ -338,10 +338,50 @@ START_TEST(eina_test_sorted_insert)
338} 338}
339END_TEST 339END_TEST
340 340
341START_TEST(eina_test_list_split)
342{
343 Eina_List *left = NULL, *right = NULL ;
344 Eina_List *list = NULL;
345 Eina_List *l;
346 void *list_data;
347 int i;
348
349 eina_init();
350
351 list = eina_list_append(list, "tigh");
352 list = eina_list_append(list, "adar");
353 list = eina_list_append(list, "baltar");
354 list = eina_list_append(list, "roslin");
355 list = eina_list_append(list, "baltar");
356 list = eina_list_append(list, "roslin");
357 list = eina_list_append(list, "baltar");
358 list = eina_list_append(list, "roslin");
359
360 fail_if(list == NULL);
361 fail_if(eina_list_count(list) != 8);
362
363 for ( i = 0; i < 200; i++)
364 {
365 left = eina_list_split_list(list, eina_list_nth_list(list, i % 2), &right);
366
367 if (i % 2 == 0)
368 fail_if(eina_list_count(left) == 1 && eina_list_count(right) + eina_list_count(left) == i + 7);
369 else
370 fail_if(eina_list_count(left) == 2 && eina_list_count(right) + eina_list_count(left) == i + 7);
371
372 list = eina_list_merge(left, right);
373 list = eina_list_append(list, "roslin");
374 }
375
376 eina_shutdown();
377}
378END_TEST
379
341void 380void
342eina_test_list(TCase *tc) 381eina_test_list(TCase *tc)
343{ 382{
344 tcase_add_test(tc, eina_test_simple); 383 tcase_add_test(tc, eina_test_simple);
345 tcase_add_test(tc, eina_test_merge); 384 tcase_add_test(tc, eina_test_merge);
346 tcase_add_test(tc, eina_test_sorted_insert); 385 tcase_add_test(tc, eina_test_sorted_insert);
386 tcase_add_test(tc, eina_test_list_split);
347} 387}