summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-12-14 20:04:31 +0000
committerLeandro Dorileo <dorileo@profusion.mobi>2012-12-14 20:04:31 +0000
commit979116ddffebc141300673cf8e373109af8162ee (patch)
tree943d8911931ce176b4644e83ffdd44f307f69f94 /legacy
parent67a601e44cf514e622acb65707f7770a6e3e61f4 (diff)
EPhysics: simplify the restacking data free routine
SVN revision: 80986
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index ebfc9c09eb..ce56efed53 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -388,18 +388,6 @@ _ephysics_body_evas_stacking_sort_cb(const void *d1, const void *d2)
388 return 0; 388 return 0;
389} 389}
390 390
391static void
392_ephysics_body_evas_objects_restack_free(void *data)
393{
394 Eina_List *l, *stack_list = (Eina_List *)data;
395 void *ldata;
396
397 EINA_LIST_FOREACH(stack_list, l, ldata)
398 free(ldata);
399
400 eina_list_free(stack_list);
401}
402
403static EPhysics_Body_Evas_Stacking * 391static EPhysics_Body_Evas_Stacking *
404_ephysics_body_evas_stacking_new(Evas_Object *obj, float index) 392_ephysics_body_evas_stacking_new(Evas_Object *obj, float index)
405{ 393{
@@ -432,13 +420,14 @@ ephysics_body_evas_objects_restack(EPhysics_World *world)
432 Eina_Hash *hash; 420 Eina_Hash *hash;
433 Eina_Iterator *it; 421 Eina_Iterator *it;
434 int layer; 422 int layer;
423 Eina_List *ll = NULL;
435 424
436 bodies = ephysics_world_bodies_get(world); 425 bodies = ephysics_world_bodies_get(world);
437 426
438 if (!eina_list_count(bodies)) 427 if (!eina_list_count(bodies))
439 return; 428 return;
440 429
441 hash = eina_hash_int32_new(_ephysics_body_evas_objects_restack_free); 430 hash = eina_hash_int32_new(NULL);
442 431
443 EINA_LIST_FREE(bodies, data) 432 EINA_LIST_FREE(bodies, data)
444 { 433 {
@@ -488,6 +477,8 @@ ephysics_body_evas_objects_restack(EPhysics_World *world)
488 _ephysics_body_evas_stacking_sort_cb); 477 _ephysics_body_evas_stacking_sort_cb);
489 prev_obj = NULL; 478 prev_obj = NULL;
490 479
480 ll = eina_list_append(ll, stack_list);
481
491 EINA_LIST_FOREACH(stack_list, l, stack_data) 482 EINA_LIST_FOREACH(stack_list, l, stack_data)
492 { 483 {
493 stacking = (EPhysics_Body_Evas_Stacking *)stack_data; 484 stacking = (EPhysics_Body_Evas_Stacking *)stack_data;
@@ -500,6 +491,15 @@ ephysics_body_evas_objects_restack(EPhysics_World *world)
500 } 491 }
501 492
502 eina_iterator_free(it); 493 eina_iterator_free(it);
494
495 EINA_LIST_FREE(ll, stack_data)
496 {
497 stack_list = (Eina_List *) stack_data;
498 eina_hash_del_by_data(hash, stack_list);
499 EINA_LIST_FREE(stack_list, slice_data)
500 free(slice_data);
501 }
502
503 eina_hash_free(hash); 503 eina_hash_free(hash);
504 return; 504 return;
505 505