diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-27 03:37:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-27 03:37:08 +0400 |
commit | 8ef934c73f3baeaa582efb8de906b27a3854979c (patch) | |
tree | 95dcb068fc96b3323e6ffe425ee6a7481b23eab4 /source/blender/editors | |
parent | cdd57d499434061de35af23790c993220922b206 (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 6 | ||||
-rw-r--r-- | source/blender/editors/metaball/mball_edit.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 9 |
4 files changed, 7 insertions, 20 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 01559a007ef..be577a3644e 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -361,7 +361,7 @@ static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, void *cv) static CVKeyIndex *popCVKeyIndex(EditNurb *editnurb, void *cv) { - return BLI_ghash_pop(editnurb->keyindex, cv, NULL); + return BLI_ghash_popkey(editnurb->keyindex, cv, NULL); } static BezTriple *getKeyIndexOrig_bezt(EditNurb *editnurb, BezTriple *bezt) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 21a63183c1a..cca696bf5ca 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2230,8 +2230,7 @@ void uiFreeBlock(const bContext *C, uiBlock *block) { uiBut *but; - while ( (but = block->buttons.first) ) { - BLI_remlink(&block->buttons, but); + while ((but = BLI_pophead(&block->buttons))) { ui_free_but(C, but); } @@ -2255,8 +2254,7 @@ void uiFreeBlocks(const bContext *C, ListBase *lb) { uiBlock *block; - while ( (block = lb->first) ) { - BLI_remlink(lb, block); + while ((block = BLI_pophead(lb))) { uiFreeBlock(C, block); } } diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index adffe16ca18..b79eeee49d7 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -501,19 +501,13 @@ bool mouse_mball(bContext *C, const int mval[2], bool extend, bool deselect, boo /* free all MetaElems from ListBase */ static void freeMetaElemlist(ListBase *lb) { - MetaElem *ml, *next; + MetaElem *ml; if (lb == NULL) return; - ml = lb->first; - while (ml) { - next = ml->next; - BLI_remlink(lb, ml); + while ((ml = BLI_pophead(lb))) { MEM_freeN(ml); - ml = next; } - - lb->first = lb->last = NULL; } diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index cbec3072c44..aaaafa93bb0 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1049,10 +1049,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches) /* if list only has 1 item, remove it from the list and return */ if (matches->first == matches->last) { /* need to remove from the list, otherwise it gets freed and then we can't return it */ - nvi = matches->first; - BLI_remlink(matches, nvi); - - return nvi; + return BLI_pophead(matches); } /* try to find the first selected F-Curve vert, then take the one after it */ @@ -1075,9 +1072,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches) /* if we're still here, this means that we failed to find anything appropriate in the first pass, * so just take the first item now... */ - nvi = matches->first; - BLI_remlink(matches, nvi); - return nvi; + return BLI_pophead(matches); } /* Find the nearest vertices (either a handle or the keyframe) that are nearest to the mouse cursor (in area coordinates) |