]> granicus.if.org Git - graphviz/commit
tools: initialize a variable
authorCosta Shulyupin <constantine.shulyupin@gmail.com>
Sun, 27 Mar 2022 04:07:38 +0000 (07:07 +0300)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 2 Apr 2022 18:59:53 +0000 (11:59 -0700)
commit82ee2f944b81f0a2c3d1a5fbe0dd16fa92da5cd1
tree4f21ce5fd8cd3586125fef1581caf045836da69b
parentf769f1102f17e10677f2d6456e96f78444d3ef0a
tools: initialize a variable

Squashing
warning: ‘sym’ may be used uninitialized in this function

Here was no real usage of uninitialized variable, but
compiler still complains.

Pointer sym is allocated when flag with_val is set:

    if (with_val) {
        sym = agattr(g, AGEDGE, "len", "1");
    }

So just squash the warning by setting the
pointer to NULL and test it in guard condition
instead of testing the flag:

            if (sym && val) {
                sprintf(buf, "%f", val[j]);
                agxset(e, sym, buf);
            }
cmd/tools/mm2gv.c