From 7e654265c98e2b8e7f24ee453ebce336db095866 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 12 Sep 2011 15:25:58 +0300 Subject: [PATCH] slist: preserve the ->line value correctly Smatch hasn't really used the ->line value up to now. Partly that's because it hasn't been showing the correct line number. In add_possible() the alloc_state_no_name() is basically trying to do a small clone of the sm_state so the line should be preserved. In merge_sm_states() it doesn't make sense to try preserve the ->line value. What we want is the the line where the merge happens. Signed-off-by: Dan Carpenter --- smatch_slist.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/smatch_slist.c b/smatch_slist.c index 9285f066..fe1cd07d 100644 --- a/smatch_slist.c +++ b/smatch_slist.c @@ -151,6 +151,7 @@ static void add_possible(struct sm_state *sm, struct sm_state *new) FOR_EACH_PTR(new->possible, tmp) { tmp2 = alloc_state_no_name(tmp->owner,tmp->name, tmp->sym, tmp->state); + tmp2->line = tmp->line; add_sm_state_slist(&sm->possible, tmp2); } END_FOR_EACH_PTR(tmp); } @@ -353,8 +354,6 @@ struct sm_state *merge_sm_states(struct sm_state *one, struct sm_state *two) return one; s = merge_states(one->owner, one->name, one->sym, one->state, two->state); result = alloc_state_no_name(one->owner, one->name, one->sym, s); - if (one->line == two->line) - result->line = one->line; result->merged = 1; result->left = one; result->right = two; -- 2.11.4.GIT