shithub: mc

Download patch

ref: ac3035a2c5d8b9580a81852ec9493831b6e13e27
parent: 637aad1be46d7ed9dfafd103dd57a4cbdcba9ca0
author: Ori Bernstein <[email protected]>
date: Mon Jun 11 09:14:23 EDT 2012

Only change the separator if we print something.

    This eliminates spurious commas.

--- a/opt/df.c
+++ b/opt/df.c
@@ -117,6 +117,7 @@
 
     for (j = 0; j < cfg->nbb; j++) {
         bb = cfg->bb[j];
+        fprintf(fd, "\n");
         fprintf(fd, "Bb: %d\n", bb->id);
 
         /* in edges */
@@ -133,13 +134,15 @@
         fprintf(fd, "Out: ");
         sep = "";
         for (i = 0; i < bsmax(bb->out); i++) {
-             if (bshas(bb->in, i))
+             if (bshas(bb->in, i)) {
                 fprintf(fd, "%d%s", i, sep);
-             sep = ",";
+                sep = ",";
+             }
         }
         fprintf(fd, "\n");
 
         for (i = 0; i < bb->nnl; i++)
             dump(bb->nl[i], fd);
+        fprintf(fd, "\n");
     }
 }