]> granicus.if.org Git - graphviz/commitdiff
remove unnecessary temporary buffer to construct error message
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 30 Jul 2020 00:11:13 +0000 (17:11 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 3 Aug 2020 13:53:57 +0000 (06:53 -0700)
The motivation for this change is to avoid passing a variable to agerr which
triggers so -Wformat-security errors after some upcoming changes. However, it's
nice to be able to just simplify this code anyway.

lib/cgraph/grammar.y

index 2507c12430a783e99be1475b3166685bf15907ce..c089677208fe3f5a6fb8be01146dfde6f8e6f926 100644 (file)
@@ -566,9 +566,7 @@ static void endgraph()
 static void opensubg(char *name)
 {
   if (++SubgraphDepth >= YYMAXDEPTH/2) {
-    char buf[128];
-    sprintf(buf,"subgraphs nested more than %d deep",YYMAXDEPTH);
-    agerr(AGERR,buf);
+    agerr(AGERR,"subgraphs nested more than %d deep",YYMAXDEPTH);
   }
        S = push(S,agsubg(S->g,name,TRUE));
        agstrfree(G,name);