diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-18 20:16:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-18 20:16:13 +0400 |
commit | 27b4b45543c0f7690a1978a60591a0b5c0f1adbb (patch) | |
tree | 14c54494059de30d8d4c8a24ec8400b8bcc83ff5 /source/blender/editors/sculpt_paint | |
parent | e982e9b04f13be046d194643ed28aaedd6181f3b (diff) |
utility functions: BLI_findptr, BLI_rfindptr --- use for finding an item in a linked list by a pointer.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index f327f67be33..c62dc687c73 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -32,6 +32,7 @@ * \ingroup edsculpt */ +#include <stddef.h> #include "MEM_guardedalloc.h" @@ -379,16 +380,12 @@ static void sculpt_undo_free(ListBase *lb) SculptUndoNode *sculpt_undo_get_node(PBVHNode *node) { ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_MESH); - SculptUndoNode *unode; - if (!lb) + if (!lb) { return NULL; + } - for (unode = lb->first; unode; unode = unode->next) - if (unode->node == node) - return unode; - - return NULL; + return BLI_findptr(lb, node, offsetof(SculptUndoNode, node)); } static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, |