From 6c8b39d31e4743ca3e6c3bda6579b3d5384288cb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 5 Nov 2012 18:32:30 +0300 Subject: [PATCH] sval: delete add_range() All the callers are updated now. Signed-off-by: Dan Carpenter --- smatch_extra.h | 1 - smatch_ranges.c | 84 --------------------------------------------------------- 2 files changed, 85 deletions(-) diff --git a/smatch_extra.h b/smatch_extra.h index 88a708b1..0a1cee4b 100644 --- a/smatch_extra.h +++ b/smatch_extra.h @@ -45,7 +45,6 @@ struct data_range *alloc_range_perm(long long min, long long max); struct data_range_sval *alloc_range_perm_sval(sval_t min, sval_t max); struct range_list_sval *alloc_range_list_sval(sval_t min, sval_t max); struct range_list_sval *whole_range_list_sval(void); -void add_range(struct range_list **list, long long min, long long max); void add_range_sval(struct range_list_sval **list, sval_t min, sval_t max); int ranges_equiv_sval(struct data_range_sval *one, struct data_range_sval *two); int range_lists_equiv_sval(struct range_list_sval *one, struct range_list_sval *two); diff --git a/smatch_ranges.c b/smatch_ranges.c index 39461e06..2864145a 100644 --- a/smatch_ranges.c +++ b/smatch_ranges.c @@ -268,90 +268,6 @@ struct range_list_sval *whole_range_list_sval(void) return alloc_range_list_sval(ll_to_sval(whole_range.min), ll_to_sval(whole_range.max)); } - -void add_range(struct range_list **list, long long min, long long max) -{ - struct data_range *tmp = NULL; - struct data_range *new = NULL; - int check_next = 0; - - /* - * FIXME: This has a problem merging a range_list like: min-0,3-max - * with a range like 1-2. You end up with min-2,3-max instead of - * just min-max. - */ - FOR_EACH_PTR(*list, tmp) { - if (check_next) { - /* Sometimes we overlap with more than one range - so we have to delete or modify the next range. */ - if (max + 1 == tmp->min) { - /* join 2 ranges here */ - new->max = tmp->max; - DELETE_CURRENT_PTR(tmp); - return; - } - - /* Doesn't overlap with the next one. */ - if (max < tmp->min) - return; - /* Partially overlaps with the next one. */ - if (max < tmp->max) { - tmp->min = max + 1; - return; - } - /* Completely overlaps with the next one. */ - if (max >= tmp->max) { - DELETE_CURRENT_PTR(tmp); - /* there could be more ranges to delete */ - continue; - } - } - if (max != whole_range.max && max + 1 == tmp->min) { - /* join 2 ranges into a big range */ - new = alloc_range(min, tmp->max); - REPLACE_CURRENT_PTR(tmp, new); - return; - } - if (max < tmp->min) { /* new range entirely below */ - new = alloc_range(min, max); - INSERT_CURRENT(new, tmp); - return; - } - if (min < tmp->min) { /* new range partially below */ - if (max < tmp->max) - max = tmp->max; - else - check_next = 1; - new = alloc_range(min, max); - REPLACE_CURRENT_PTR(tmp, new); - if (!check_next) - return; - continue; - } - if (max <= tmp->max) /* new range already included */ - return; - if (min <= tmp->max) { /* new range partially above */ - min = tmp->min; - new = alloc_range(min, max); - REPLACE_CURRENT_PTR(tmp, new); - check_next = 1; - continue; - } - if (min != whole_range.min && min - 1 == tmp->max) { - /* join 2 ranges into a big range */ - new = alloc_range(tmp->min, max); - REPLACE_CURRENT_PTR(tmp, new); - check_next = 1; - continue; - } - /* the new range is entirely above the existing ranges */ - } END_FOR_EACH_PTR(tmp); - if (check_next) - return; - new = alloc_range(min, max); - add_ptr_list(list, new); -} - void add_range_sval(struct range_list_sval **list, sval_t min, sval_t max) { struct data_range_sval *tmp = NULL; -- 2.11.4.GIT