From 162aa09d3d08d67d1a5778af2e6f65137dc0c6df Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sun, 27 May 2012 21:28:07 +0300 Subject: [PATCH] slist: put the sm_state itself into ->possible not a copy of the sm_state This was a huge memory waster. We did a bunch of needless copies with merge_sm_state(). The add_sm_state() function doesn't even add the new sm_state if it was already included. With this change I don't have any more places on my kernel build where I bailing because functions are too complicated. But another reason to do this is that I want the ->possible states to have a valid ->pool pointer for some later work. Signed-off-by: Dan Carpenter --- smatch_slist.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/smatch_slist.c b/smatch_slist.c index dbb690ea..0814ddfd 100644 --- a/smatch_slist.c +++ b/smatch_slist.c @@ -168,13 +168,9 @@ void add_sm_state_slist(struct state_list **slist, struct sm_state *new) static void copy_possibles(struct sm_state *to, struct sm_state *from) { struct sm_state *tmp; - struct sm_state *tmp2; FOR_EACH_PTR(from->possible, tmp) { - tmp2 = alloc_state_no_name(tmp->owner, tmp->name, tmp->sym, - tmp->state); - tmp2->line = tmp->line; - add_sm_state_slist(&to->possible, tmp2); + add_sm_state_slist(&to->possible, tmp); } END_FOR_EACH_PTR(tmp); } -- 2.11.4.GIT