From 8ef934c73f3baeaa582efb8de906b27a3854979c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Aug 2013 23:37:08 +0000 Subject: ghash/bli-listbase edits, rename BLI_ghash_pop -> BLI_ghash_popkey (since it takes a key as an arg and isnt popping any element from the hash as you might expect). add BLI_pophead/tail, since getting the first element from a list and removing it is a common task. --- source/blender/blenkernel/intern/sca.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern/sca.c') diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 92f57a54a01..091b5f337c6 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -63,8 +63,7 @@ void free_sensors(ListBase *lb) { bSensor *sens; - while ((sens= lb->first)) { - BLI_remlink(lb, sens); + while ((sens = BLI_pophead(lb))) { free_sensor(sens); } } @@ -227,9 +226,9 @@ void free_controllers(ListBase *lb) { bController *cont; - while ((cont= lb->first)) { - BLI_remlink(lb, cont); - if (cont->slinks) MEM_freeN(cont->slinks); + while ((cont = BLI_pophead(lb))) { + if (cont->slinks) + MEM_freeN(cont->slinks); free_controller(cont); } } @@ -346,8 +345,7 @@ void free_actuators(ListBase *lb) { bActuator *act; - while ((act= lb->first)) { - BLI_remlink(lb, act); + while ((act = BLI_pophead(lb))) { free_actuator(act); } } -- cgit v1.2.3