]> granicus.if.org Git - graphviz/commitdiff
use agxbprint in genBundleSpline, removing the need for a temporary buffer
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 1 Sep 2020 00:36:31 +0000 (17:36 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 17 Sep 2020 04:08:22 +0000 (21:08 -0700)
cmd/mingle/minglemain.c

index 31013c6504c7fefe6482a530bf5e7baa55d43a14..522e424cd2e0747fe8fd3a83d36faaf3f4873f0d 100644 (file)
@@ -242,7 +242,6 @@ static void
 genBundleSpline (pedge edge, agxbuf* xb)
 {
        int k, j, mm, kk;
-       char buf[BUFSIZ];
        int dim = edge->dim;
        real* x = edge->x;
        real tt1[3]={0.15,0.5,0.85};
@@ -263,8 +262,7 @@ genBundleSpline (pedge edge, agxbuf* xb)
                                t = tt[kk-1];
                                for (k = 0; k < dim; k++) {
                                        if (k != 0) agxbputc(xb,',');
-                                       sprintf(buf, "%.03f", (x[(j-1)*dim+k]*(1-t)+x[j*dim+k]*(t)));
-                                       agxbput(xb, buf);
+                                       agxbprint(xb, "%.03f", (x[(j-1)*dim+k]*(1-t)+x[j*dim+k]*(t)));
                                }
                                agxbputc(xb,' ');
                        }
@@ -272,8 +270,7 @@ genBundleSpline (pedge edge, agxbuf* xb)
                if ((j == 0) || (j == edge->npoints - 1)) {
                        for (k = 0; k < dim; k++) {
                                if (k != 0) agxbputc(xb,',');
-                               sprintf(buf, "%.03f", x[j*dim+k]);
-                               agxbput(xb, buf);
+                               agxbprint(xb, "%.03f", x[j*dim+k]);
                        }
                }
     }