isl_qpolynomial_reset_domain_space: fix memory management annotation
[isl.git] / isl_union_print_templ.c
blob3995a129193ace4264abae189bb1cf6f58c32159
1 /*
2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * INRIA Saclay - Ile-de-France, Parc Club Orsay Universite,
8 * ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France
9 */
11 #include "isl_union_macro.h"
13 /* Print "pw" in a sequence of "PART" objects delimited by semicolons.
14 * Each "PART" object itself is also printed as a semicolon delimited
15 * sequence of pieces.
16 * If data->first = 1, then this is the first in the sequence.
17 * Update data->first to tell the next element that it is not the first.
19 static isl_stat FN(print_body_wrap,BASE)(__isl_take PART *pw,
20 void *user)
22 struct isl_union_print_data *data;
23 data = (struct isl_union_print_data *) user;
25 if (!data->first)
26 data->p = isl_printer_print_str(data->p, "; ");
27 data->first = 0;
29 data->p = FN(print_body,BASE)(data->p, pw);
30 FN(PART,free)(pw);
32 return isl_stat_non_null(data->p);
35 /* Print the body of "u" (everything except the parameter declarations)
36 * to "p" in isl format.
38 static __isl_give isl_printer *FN(print_body_union,BASE)(
39 __isl_take isl_printer *p, __isl_keep UNION *u)
41 struct isl_union_print_data data;
43 p = isl_printer_print_str(p, s_open_set[0]);
44 data.p = p;
45 data.first = 1;
46 if (FN(FN(UNION,foreach),BASE)(u, &FN(print_body_wrap,BASE), &data) < 0)
47 data.p = isl_printer_free(data.p);
48 p = data.p;
49 p = isl_printer_print_str(p, s_close_set[0]);
51 return p;
54 /* Print the "UNION" object "u" to "p" in isl format.
56 static __isl_give isl_printer *FN(FN(print_union,BASE),isl)(
57 __isl_take isl_printer *p, __isl_keep UNION *u)
59 struct isl_print_space_data space_data = { 0 };
60 isl_space *space;
62 space = FN(UNION,get_space)(u);
63 p = print_param_tuple(p, space, &space_data);
64 isl_space_free(space);
66 p = FN(print_body_union,BASE)(p, u);
68 return p;