core: make fake cur_slists stackable
[smatch.git] / smatch_expression_stacks.c
blob5d74e2034cbd149288c68155b02a44619c0df11e
1 /*
2 * sparse/smatch_expression_stacks.c
4 * Copyright (C) 2009 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
11 #include "smatch_expression_stacks.h"
13 void push_expression(struct expression_list **estack, struct expression *expr)
15 add_ptr_list(estack, expr);
18 struct expression *pop_expression(struct expression_list **estack)
20 struct expression *expr;
22 expr = last_ptr_list((struct ptr_list *)*estack);
23 delete_ptr_list_last((struct ptr_list **)estack);
24 return expr;
27 struct expression *top_expression(struct expression_list *estack)
29 struct expression *expr;
31 expr = last_ptr_list((struct ptr_list *)estack);
32 return expr;
35 void free_expression_stack(struct expression_list **estack)
37 __free_ptr_list((struct ptr_list **)estack);