isl_printer_print_basic_set: fix up printing to string printer
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 18 Apr 2010 19:55:05 +0000 (21:55 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 18 Apr 2010 19:55:05 +0000 (21:55 +0200)
In particular, only print prefix and suffix (and call strlen on them)
if they are not NULL.

Problem reported by Tomofumi Yuki <yuki@cs.colostate.edu>

isl_printer.c

index 51e1f39..6011dd6 100644 (file)
@@ -85,13 +85,15 @@ error:
 static __isl_give isl_printer *str_start_line(__isl_take isl_printer *p)
 {
        p = str_print_indent(p, p->indent);
-       p = str_print(p, p->prefix, strlen(p->prefix));
+       if (p->prefix)
+               p = str_print(p, p->prefix, strlen(p->prefix));
        return p;
 }
 
 static __isl_give isl_printer *str_end_line(__isl_take isl_printer *p)
 {
-       p = str_print(p, p->suffix, strlen(p->suffix));
+       if (p->suffix)
+               p = str_print(p, p->suffix, strlen(p->suffix));
        p = str_print(p, "\n", strlen("\n"));
        return p;
 }