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