From 5c4180d89881c08c34e1829fc1998937381a6b59 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Jul 2014 20:37:06 +1000 Subject: BLI_stack: various small additions - add BLI_stack_count - add BLI_stack_pop_n to pop into an array - add BLI_stack_push_r, which returns a pointer that can be filled in Also remove sanity check in BLI_stack_pop, assert if the stack is empty. --- source/blender/blenlib/BLI_stack.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source/blender/blenlib/BLI_stack.h') diff --git a/source/blender/blenlib/BLI_stack.h b/source/blender/blenlib/BLI_stack.h index d65c8f02462..1e0b29bc7e8 100644 --- a/source/blender/blenlib/BLI_stack.h +++ b/source/blender/blenlib/BLI_stack.h @@ -34,16 +34,20 @@ typedef struct BLI_Stack BLI_Stack; BLI_Stack *BLI_stack_new_ex( const size_t elem_size, const char *description, - const size_t chunk_size) ATTR_NONNULL(); + const size_t chunk_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BLI_Stack *BLI_stack_new( - const size_t elem_size, const char *description) ATTR_NONNULL(); + const size_t elem_size, const char *description) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL(); -void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL(); +void *BLI_stack_push_r(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL(); +void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL(); void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL(); -bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_NONNULL(); +size_t BLI_stack_count(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -#endif +bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + +#endif /* __BLI_STACK_H__ */ -- cgit v1.2.3