-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack.c
47 lines (34 loc) · 2.17 KB
/
stack.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*****************************************************************************
* *
* ------------------------------- stack.c -------------------------------- *
* *
*****************************************************************************/
#include <stdlib.h>
#include "list.h"
#include "stack.h"
/*****************************************************************************
* *
* ------------------------------ stack_push ------------------------------ *
* *
*****************************************************************************/
int stack_push(Stack *stack, const void *data) {
/*****************************************************************************
* *
* Push the data onto the stack. *
* *
*****************************************************************************/
return list_ins_next(stack, NULL, data);
}
/*****************************************************************************
* *
* ------------------------------ stack_pop ------------------------------- *
* *
*****************************************************************************/
int stack_pop(Stack *stack, void **data) {
/*****************************************************************************
* *
* Pop the data off the stack. *
* *
*****************************************************************************/
return list_rem_next(stack, NULL, data);
}