From: Sven Verdoolaege Date: Mon, 3 Aug 2009 10:01:57 +0000 (+0200) Subject: isl_{set,map}_add: don't add obviously empty basic sets/maps X-Git-Tag: isl-0.01~106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=407288942014b171018bac705a0c16af00531673;p=platform%2Fupstream%2Fisl.git isl_{set,map}_add: don't add obviously empty basic sets/maps --- diff --git a/isl_map.c b/isl_map.c index 0f2f804..3fec937 100644 --- a/isl_map.c +++ b/isl_map.c @@ -1524,19 +1524,8 @@ struct isl_map *isl_map_from_basic_map(struct isl_basic_map *bmap) struct isl_set *isl_set_add(struct isl_set *set, struct isl_basic_set *bset) { - if (!bset || !set) - goto error; - isl_assert(set->ctx, isl_dim_equal(set->dim, bset->dim), goto error); - isl_assert(set->ctx, set->n < set->size, goto error); - set->p[set->n] = bset; - set->n++; - return set; -error: - if (set) - isl_set_free(set); - if (bset) - isl_basic_set_free(bset); - return NULL; + return (struct isl_set *)isl_map_add((struct isl_map *)set, + (struct isl_basic_map *)bset); } void isl_set_free(struct isl_set *set) @@ -2746,6 +2735,10 @@ struct isl_map *isl_map_add(struct isl_map *map, struct isl_basic_map *bmap) { if (!bmap || !map) goto error; + if (isl_basic_map_fast_is_empty(bmap)) { + isl_basic_map_free(bmap); + return map; + } isl_assert(map->ctx, isl_dim_equal(map->dim, bmap->dim), goto error); isl_assert(map->ctx, map->n < map->size, goto error); map->p[map->n] = bmap;