mark isl_set_dim_is_unique as deprecated
[isl.git] / isl_multi_coalesce.c
blobaef59e887fd60e31d866f705005f4e2689788554
1 /*
2 * Copyright 2013 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8 */
10 #include <isl_multi_macro.h>
12 /* Coalesce the elements of "multi".
14 * Note that such coalescing does not change the meaning of "multi"
15 * so there is no need to cow. We do need to be careful not to
16 * destroy any other copies of "multi" in case of failure.
18 __isl_give MULTI(BASE) *FN(MULTI(BASE),coalesce)(__isl_take MULTI(BASE) *multi)
20 int i;
22 if (!multi)
23 return NULL;
25 for (i = 0; i < multi->n; ++i) {
26 EL *el = FN(EL,copy)(multi->p[i]);
27 el = FN(EL,coalesce)(el);
28 if (!el)
29 return FN(MULTI(BASE),free)(multi);
30 FN(EL,free)(multi->p[i]);
31 multi->p[i] = el;
34 return multi;