]> granicus.if.org Git - graphviz/commitdiff
Revert "common: inline and remove 'printdouble'"
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 4 Jun 2022 15:24:46 +0000 (08:24 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 5 Jun 2022 18:28:25 +0000 (11:28 -0700)
This reverts commit eb9c96face472a4f8e6b44834dbe2e5d79d80c53.

lib/common/output.c

index a6387ab614f1debe8cafc67668f9e36d04bc6468..f591beeaacbca56ef1248eec3c2011b690b07bfe 100644 (file)
@@ -37,9 +37,20 @@ static void agputc (int c, FILE* fp)
   print(fp, "%c", (char)c);
 }
 
+
+static void printdouble(FILE * f, char *prefix, double v)
+{
+    char buf[BUFSIZ];
+    
+    if (prefix) agputs(prefix, f);
+    snprintf(buf, sizeof(buf), "%.5g", v);
+    agputs(buf, f);
+}
+
 static void printpoint(FILE * f, pointf p)
 {
-  print(f, " %.5g %.5g", PS2INCH(p.x), PS2INCH(YDIR(p.y)));
+    printdouble(f, " ", PS2INCH(p.x));
+    printdouble(f, " ", PS2INCH(YDIR(p.y)));
 }
 
 /* setYInvert:
@@ -95,9 +106,9 @@ void write_plain(GVJ_t *job, graph_t *g, FILE *f, bool extend) {
 //    setup_graph(job, g);
     setYInvert(g);
     pt = GD_bb(g).UR;
-    print(f, "graph %.5g", job->zoom);
-    print(f, " %.5g", PS2INCH(pt.x));
-    print(f, " %.5g", PS2INCH(pt.y));
+    printdouble(f, "graph ", job->zoom);
+    printdouble(f, " ", PS2INCH(pt.x));
+    printdouble(f, " ", PS2INCH(pt.y));
     agputc('\n', f);
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
        if (IS_CLUST_NODE(n))
@@ -108,8 +119,8 @@ void write_plain(GVJ_t *job, graph_t *g, FILE *f, bool extend) {
            lbl = agcanonStr (agxget(n, N_label));
        else
            lbl = canon(agraphof(n),ND_label(n)->text);
-        print(f, " %.5g", ND_width(n));
-        print(f, " %.5g", ND_height(n));
+        printdouble(f, " ", ND_width(n));
+        printdouble(f, " ", ND_height(n));
         print(f, " %s", lbl);
        print(f, " %s", late_nnstring(n, N_style, "solid"));
        print(f, " %s", ND_shape(n)->name);