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/key.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'source/blender/blenkernel/intern/key.c') diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index aaac17ac1ed..7b73dee73fc 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -85,29 +85,23 @@ void BKE_key_free(Key *key) KeyBlock *kb; BKE_free_animdata((ID *)key); - - while ( (kb = key->block.first) ) { - - if (kb->data) MEM_freeN(kb->data); - - BLI_remlink(&key->block, kb); + + while ((kb = BLI_pophead(&key->block))) { + if (kb->data) + MEM_freeN(kb->data); MEM_freeN(kb); } - } void BKE_key_free_nolib(Key *key) { KeyBlock *kb; - - while ( (kb = key->block.first) ) { - - if (kb->data) MEM_freeN(kb->data); - - BLI_remlink(&key->block, kb); + + while ((kb = BLI_pophead(&key->block))) { + if (kb->data) + MEM_freeN(kb->data); MEM_freeN(kb); } - } Key *BKE_key_add(ID *id) /* common function */ -- cgit v1.2.3