isl_printer_print_pw_aff: fix printing in C format
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 7 Feb 2012 11:13:23 +0000 (12:13 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 7 Feb 2012 11:57:05 +0000 (12:57 +0100)
In 3280c05 (make isl_pw_* object live in a map space,
Tue Aug 30 16:47:59 2011 +0200), the space in which objects live was
changed from that of its domain to that of a map, but
isl_printer_print_pw_aff was not changed accordingly.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_output.c

index 6883e7f..c75503e 100644 (file)
@@ -2204,19 +2204,25 @@ static __isl_give isl_printer *print_pw_aff_c(__isl_take isl_printer *p,
        __isl_keep isl_pw_aff *pwaff)
 {
        int i;
+       isl_space *space;
 
        if (pwaff->n < 1)
                isl_die(p->ctx, isl_error_unsupported,
                        "cannot print empty isl_pw_aff in C format", goto error);
+       space = isl_pw_aff_get_domain_space(pwaff);
+       if (!space)
+               goto error;
 
        for (i = 0; i < pwaff->n - 1; ++i) {
                p = isl_printer_print_str(p, "(");
-               p = print_set_c(p, pwaff->dim, pwaff->p[i].set);
+               p = print_set_c(p, space, pwaff->p[i].set);
                p = isl_printer_print_str(p, ") ? (");
                p = print_aff_c(p, pwaff->p[i].aff);
                p = isl_printer_print_str(p, ") : ");
        }
 
+       isl_space_free(space);
+
        return print_aff_c(p, pwaff->p[pwaff->n - 1].aff);
 error:
        isl_printer_free(p);