From: Matthew Fernandez Date: Thu, 12 May 2022 04:37:05 +0000 (-0700) Subject: gv2gml: remove 'outFile' parameter to 'emitAttr' X-Git-Tag: 4.0.0~31^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38b8b20f579a06cf3eb0e5d905bde8ee28be7c3f;p=graphviz gv2gml: remove 'outFile' parameter to 'emitAttr' The only calls to this function pass `outFile`, an already available global that this parameter was shadowing. This removes numerous -Wshadow warnings. --- diff --git a/cmd/tools/gv2gml.c b/cmd/tools/gv2gml.c index ddb323a39..e25e7d087 100644 --- a/cmd/tools/gv2gml.c +++ b/cmd/tools/gv2gml.c @@ -226,9 +226,7 @@ static inline int xml_puts(FILE *stream, const char *s) { return xml_escape(s, flags, put, stream); } -static void -emitAttr (char* name, char* value, FILE* outFile, int ix) -{ +static void emitAttr(char *name, char *value, int ix) { indent (ix, outFile); if (isNumber (value)) fprintf (outFile, "%s %s\n", name, value); @@ -277,12 +275,12 @@ static void emitNodeAttrs(Agraph_t *G, Agnode_t *np, int ix) { v = agxget (np, s); if (streq("\\N", v)) { label = agnameof(np); - emitAttr (s->name, label, outFile, ix); + emitAttr(s->name, label, ix); doLabelGraphics = 1; } else if (*v) { label = v; - emitAttr (s->name, label, outFile, ix); + emitAttr(s->name, label, ix); doLabelGraphics = 1; } } @@ -362,7 +360,7 @@ static void emitNodeAttrs(Agraph_t *G, Agnode_t *np, int ix) { } else { v = agxget (np, s); - emitAttr (s->name, v, outFile, ix); + emitAttr(s->name, v, ix); } } @@ -386,37 +384,37 @@ static void emitNodeAttrs(Agraph_t *G, Agnode_t *np, int ix) { emitInt ("hasFill", 1, outFile, ix+1); } if (attrs.type) { - emitAttr ("type", attrs.type, outFile, ix+1); + emitAttr("type", attrs.type, ix+1); } if (attrs.image) { - emitAttr ("image", attrs.image, outFile, ix+1); + emitAttr("image", attrs.image, ix+1); } if (attrs.fill) { - emitAttr ("fill", attrs.fill, outFile, ix+1); + emitAttr("fill", attrs.fill, ix+1); } if (attrs.outline) { - emitAttr ("outline", attrs.outline, outFile, ix+1); + emitAttr("outline", attrs.outline, ix+1); } if (attrs.width) { - emitAttr ("width", attrs.width, outFile, ix+1); + emitAttr("width", attrs.width, ix+1); } if (attrs.outlineStyle) { - emitAttr ("outlineStyle", attrs.outlineStyle, outFile, ix+1); + emitAttr("outlineStyle", attrs.outlineStyle, ix+1); } fprintf (outFile, " ]\n"); } if (doLabelGraphics) { fprintf (outFile, " LabelGraphics [\n"); - if (label) emitAttr ("text", label, outFile, ix+1); + if (label) emitAttr("text", label, ix+1); if (attrs.fontColor) { - emitAttr ("fontColor", attrs.fontColor, outFile, ix+1); + emitAttr("fontColor", attrs.fontColor, ix+1); } if (attrs.fontSize) { - emitAttr ("fontSize", attrs.fontSize, outFile, ix+1); + emitAttr("fontSize", attrs.fontSize, ix+1); } if (attrs.fontName) { - emitAttr ("fontName", attrs.fontName, outFile, ix+1); + emitAttr("fontName", attrs.fontName, ix+1); } fprintf (outFile, " ]\n"); } @@ -472,7 +470,7 @@ static void emitEdgeAttrs(Agraph_t *G, Agedge_t *ep, int ix) { else if (streq(s->name, "label")) { if (*(v = agxget (ep, s))) { label = v; - emitAttr (s->name, label, outFile, ix); + emitAttr(s->name, label, ix); doLabelGraphics = 1; } } @@ -538,7 +536,7 @@ static void emitEdgeAttrs(Agraph_t *G, Agedge_t *ep, int ix) { } else { v = agxget (ep, s); - emitAttr (s->name, v, outFile, ix); + emitAttr(s->name, v, ix); } } @@ -552,50 +550,50 @@ static void emitEdgeAttrs(Agraph_t *G, Agedge_t *ep, int ix) { emitInt ("visible", 0, outFile, ix+1); } if (attrs.fill) { - emitAttr ("fill", attrs.fill, outFile, ix+1); + emitAttr("fill", attrs.fill, ix+1); } if (attrs.width) { - emitAttr ("width", attrs.width, outFile, ix+1); + emitAttr("width", attrs.width, ix+1); } if (attrs.arrowhead) { - emitAttr ("targetArrow", attrs.arrowhead, outFile, ix+1); + emitAttr("targetArrow", attrs.arrowhead, ix+1); } if (attrs.arrowtail) { - emitAttr ("sourceArrow", attrs.arrowtail, outFile, ix+1); + emitAttr("sourceArrow", attrs.arrowtail, ix+1); } if (attrs.flags & DASH) { - emitAttr ("style", "dashed", outFile, ix+1); + emitAttr("style", "dashed", ix+1); } else if (attrs.flags & DOT) { - emitAttr ("style", "dotted", outFile, ix+1); + emitAttr("style", "dotted", ix+1); } else if (attrs.flags & LINE) { - emitAttr ("style", "line", outFile, ix+1); + emitAttr("style", "line", ix+1); } if (attrs.arrow) { if (streq(attrs.arrow,"forward")) - emitAttr ("arrow", "first", outFile, ix+1); + emitAttr("arrow", "first", ix+1); else if (streq(attrs.arrow,"back")) - emitAttr ("arrow", "last", outFile, ix+1); + emitAttr("arrow", "last", ix+1); else if (streq(attrs.arrow,"both")) - emitAttr ("arrow", "both", outFile, ix+1); + emitAttr("arrow", "both", ix+1); else if (streq(attrs.arrow,"none")) - emitAttr ("arrow", "none", outFile, ix+1); + emitAttr("arrow", "none", ix+1); } fprintf (outFile, " ]\n"); } if (doLabelGraphics) { fprintf (outFile, " LabelGraphics [\n"); - if (label) emitAttr ("text", label, outFile, ix+1); + if (label) emitAttr("text", label, ix+1); if (attrs.fontColor) { - emitAttr ("fontColor", attrs.fontColor, outFile, ix+1); + emitAttr("fontColor", attrs.fontColor, ix+1); } if (attrs.fontSize) { - emitAttr ("fontSize", attrs.fontSize, outFile, ix+1); + emitAttr("fontSize", attrs.fontSize, ix+1); } if (attrs.fontName) { - emitAttr ("fontName", attrs.fontName, outFile, ix+1); + emitAttr("fontName", attrs.fontName, ix+1); } fprintf (outFile, " ]\n"); } @@ -615,7 +613,7 @@ static void emitGraphAttrs(Agraph_t *G) { for (s = agnxtattr (G, AGRAPH, NULL); s; s = agnxtattr (G, AGRAPH, s)) { if (*(v = agxget (G, s))) { - emitAttr (s->name, v, outFile, 1); + emitAttr(s->name, v, 1); } } }