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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-06-19 08:54:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-06-19 08:54:42 +0300
commitd4aeec9204e9c4a8e1d0980cca0eacd6c8c54eaf (patch)
tree4ba9f3fc40937679e8dfad8b3456ab69eab052d8 /source/blender
parent9b3722b414b259ad440c1b28a20ee369cb8114ba (diff)
BLI_stack: function comments
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/intern/stack.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/stack.c b/source/blender/blenlib/intern/stack.c
index 3c9e1a52cda..36fad5a278b 100644
--- a/source/blender/blenlib/intern/stack.c
+++ b/source/blender/blenlib/intern/stack.c
@@ -125,8 +125,10 @@ void BLI_stack_free(BLI_Stack *stack)
}
/**
- * Copies the source value onto the stack (note that it copies
- * elem_size bytes from 'src', the pointer itself is not stored)
+ * Push a new item onto the stack.
+ *
+ * \return a pointer #BLI_Stack.elem_size
+ * bytes of uninitialized memory (caller must fill in).
*/
void *BLI_stack_push_r(BLI_Stack *stack)
{
@@ -158,6 +160,14 @@ void *BLI_stack_push_r(BLI_Stack *stack)
return CHUNK_LAST_ELEM(stack);
}
+/**
+ * Copies the source value onto the stack
+ *
+ * \note This copies #BLI_Stack.elem_size bytes from \a src,
+ * (the pointer itself is not stored).
+ *
+ * \param src: source data to be copied to the stack.
+ */
void BLI_stack_push(BLI_Stack *stack, const void *src)
{
void *dst = BLI_stack_push_r(stack);
@@ -179,6 +189,15 @@ void BLI_stack_pop(BLI_Stack *stack, void *dst)
BLI_stack_discard(stack);
}
+/**
+ * A version of #BLI_stack_pop which which fills in an array.
+ *
+ * \param dst: The destination array,
+ * must be at least (#BLI_Stack.elem_size * \a n) bytes long.
+ * \param n: The number of items to pop.
+ *
+ * \note The first item in the array will be last item added to the stack.
+ */
void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n)
{
BLI_assert(n <= BLI_stack_count(stack));
@@ -196,6 +215,9 @@ void *BLI_stack_peek(BLI_Stack *stack)
return CHUNK_LAST_ELEM(stack);
}
+/**
+ * Removes the top element from the stack.
+ */
void BLI_stack_discard(BLI_Stack *stack)
{
BLI_assert(BLI_stack_is_empty(stack) == false);