diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-07-15 14:37:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-07-15 15:09:03 +0400 |
commit | 5c4180d89881c08c34e1829fc1998937381a6b59 (patch) | |
tree | 061f1984607e705a63c78e92389249d4a803207b /source/blender/blenlib/BLI_stack.h | |
parent | a378f8d2d8f7d30eb699ee2f16e111f60b7900df (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/BLI_stack.h')
-rw-r--r-- | source/blender/blenlib/BLI_stack.h | 14 |
1 files changed, 9 insertions, 5 deletions
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__ */ |