summaryrefslogtreecommitdiff
path: root/src/data/stack.c
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-11-07 22:11:06 +0000
committerPaul Buetow <paul@buetow.org>2008-11-07 22:11:06 +0000
commita46655f67043af257e70715903badf9d4321c4de (patch)
tree556997ba868ac106c6f92703e6e35875e4872dc2 /src/data/stack.c
parentfbff89d91c2a13155423bd83d2bbefd5d6891e23 (diff)
one step further for arrays.
Diffstat (limited to 'src/data/stack.c')
-rw-r--r--src/data/stack.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/data/stack.c b/src/data/stack.c
index f1da22a..00d5d88 100644
--- a/src/data/stack.c
+++ b/src/data/stack.c
@@ -93,6 +93,14 @@ stack_pop(Stack *p_stack) {
return (p_val);
}
+void*
+stack_top(Stack *p_stack) {
+ if (stack_empty(p_stack))
+ return (NULL);
+
+ return (p_stack->p_first->p_val);
+}
+
void
stack_clear(Stack *p_stack) {
for (;!stack_empty(p_stack); stack_pop(p_stack));