]> granicus.if.org Git - graphviz/commitdiff
gvpr: more tightly scope 'nextg'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 28 Aug 2022 03:18:07 +0000 (20:18 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 30 Aug 2022 14:55:43 +0000 (07:55 -0700)
This squashes a -Wclobbered compiler warning. Though, as discussed in the prior
commit, I believe this to be a false positive.

As of this commit, Graphviz builds free of -Wclobbered warnings.

Gitlab: closes #1801

lib/gvpr/gvpr.c

index 8cdec77e809d3ea63dd28bb8913fc7704132de74..6a1df2a50088ea85b6cca18cfda46411bf7e44f5 100644 (file)
@@ -936,7 +936,6 @@ static int gvpr_core(int argc, char *argv[], gvpropts *uopts,
     gpr_info info;
     int rv = 0;
     int cleanup, i, incoreGraphs;
-    Agraph_t* nextg = NULL;
 
     setErrorErrors (0);
     ingDisc.dflt = sfstdin;
@@ -1012,6 +1011,7 @@ static int gvpr_core(int argc, char *argv[], gvpropts *uopts,
            gs->ing = newIng(0, gs->opts.inFiles, &ingDisc);
        
        if (gs->opts.verbose) gvstart_timer ();
+       Agraph_t* nextg = NULL;
        for (gs->state->curgraph = nextGraph(gs->ing); gs->state->curgraph;
             gs->state->curgraph = nextg) {
            if (gs->opts.verbose) fprintf(stderr, "Read graph: %.2f secs.\n", gvelapsed_sec());