Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-06-24 15:59:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-24 16:14:22 +0400
commit77616cbe1150293ee04880e71bc1bd71ba4e4204 (patch)
tree3038ca3f63982a46a052bfff9eaf48b8531924ca /source
parent0bc94f8c7ddf1dcc5f2ff385b42da70e2c7da6db (diff)
add STACK_REMOVE macro
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_utildefines.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 600476b9038..4333ef1ce3f 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -343,6 +343,11 @@
#define STACK_POP_PTR(stack) ((_##stack##_index) ? &((stack)[--(_##stack##_index)]) : NULL)
#define STACK_POP_DEFAULT(stack, r) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : r)
#define STACK_FREE(stack) ((void)stack)
+/* take care, re-orders */
+#define STACK_REMOVE(stack, i) \
+ if (--_##stack##_index != i) { \
+ stack[i] = stack[_##stack##_index]; \
+ } (void)0
#ifdef __GNUC__
#define STACK_SWAP(stack_a, stack_b) { \
SWAP(typeof(stack_a), stack_a, stack_b); \