1*1f5207b7SJohn Levon /*
2*1f5207b7SJohn Levon  * Copyright (C) 2009 Dan Carpenter.
3*1f5207b7SJohn Levon  *
4*1f5207b7SJohn Levon  * This program is free software; you can redistribute it and/or
5*1f5207b7SJohn Levon  * modify it under the terms of the GNU General Public License
6*1f5207b7SJohn Levon  * as published by the Free Software Foundation; either version 2
7*1f5207b7SJohn Levon  * of the License, or (at your option) any later version.
8*1f5207b7SJohn Levon  *
9*1f5207b7SJohn Levon  * This program is distributed in the hope that it will be useful,
10*1f5207b7SJohn Levon  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*1f5207b7SJohn Levon  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*1f5207b7SJohn Levon  * GNU General Public License for more details.
13*1f5207b7SJohn Levon  *
14*1f5207b7SJohn Levon  * You should have received a copy of the GNU General Public License
15*1f5207b7SJohn Levon  * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
16*1f5207b7SJohn Levon  */
17*1f5207b7SJohn Levon 
18*1f5207b7SJohn Levon #include "smatch.h"
19*1f5207b7SJohn Levon #include "smatch_expression_stacks.h"
20*1f5207b7SJohn Levon 
push_expression(struct expression_list ** estack,struct expression * expr)21*1f5207b7SJohn Levon void push_expression(struct expression_list **estack, struct expression *expr)
22*1f5207b7SJohn Levon {
23*1f5207b7SJohn Levon 	add_ptr_list(estack, expr);
24*1f5207b7SJohn Levon }
25*1f5207b7SJohn Levon 
pop_expression(struct expression_list ** estack)26*1f5207b7SJohn Levon struct expression *pop_expression(struct expression_list **estack)
27*1f5207b7SJohn Levon {
28*1f5207b7SJohn Levon 	struct expression *expr;
29*1f5207b7SJohn Levon 
30*1f5207b7SJohn Levon 	expr = last_ptr_list((struct ptr_list *)*estack);
31*1f5207b7SJohn Levon 	delete_ptr_list_last((struct ptr_list **)estack);
32*1f5207b7SJohn Levon 	return expr;
33*1f5207b7SJohn Levon }
34*1f5207b7SJohn Levon 
top_expression(struct expression_list * estack)35*1f5207b7SJohn Levon struct expression *top_expression(struct expression_list *estack)
36*1f5207b7SJohn Levon {
37*1f5207b7SJohn Levon 	struct expression *expr;
38*1f5207b7SJohn Levon 
39*1f5207b7SJohn Levon 	expr = last_ptr_list((struct ptr_list *)estack);
40*1f5207b7SJohn Levon 	return expr;
41*1f5207b7SJohn Levon }
42*1f5207b7SJohn Levon 
free_expression_stack(struct expression_list ** estack)43*1f5207b7SJohn Levon void free_expression_stack(struct expression_list **estack)
44*1f5207b7SJohn Levon {
45*1f5207b7SJohn Levon 	__free_ptr_list((struct ptr_list **)estack);
46*1f5207b7SJohn Levon }
47