From: Matthew Fernandez Date: Thu, 3 Nov 2022 02:23:27 +0000 (-0700) Subject: smyrna: remove 'line' shadowing in 'load_attributes' X-Git-Tag: 7.0.1~5^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a803f0eb43529f4de68260bc49d97e966e89a72;p=graphviz smyrna: remove 'line' shadowing in 'load_attributes' Squashes a compiler warning: gui/gui.c: In function ‘load_attributes’: gui/gui.c:45:10: warning: declaration of ‘line’ shadows a global declaration [-Wshadow] 45 | char line[BUFSIZ]; | ^~~~ In file included from ./smyrnadefs.h:27, from gui/gui.h:13, from gui/gui.c:14: ../../lib/glcomp/glutils.h:25:7: note: shadowed declaration is here 25 | } line; | ^~~~ --- diff --git a/cmd/smyrna/gui/gui.c b/cmd/smyrna/gui/gui.c index 1b706c9ea..4e534c79f 100644 --- a/cmd/smyrna/gui/gui.c +++ b/cmd/smyrna/gui/gui.c @@ -42,7 +42,7 @@ void load_graph_properties(void) { void load_attributes(void) { FILE *file; - char line[BUFSIZ]; + char buffer[BUFSIZ]; char *pch; static char *smyrna_attrs; @@ -52,8 +52,9 @@ void load_attributes(void) //loads attributes from a text file file = fopen(smyrna_attrs, "r"); if (file != NULL) { - for (int attrcount = 0; fgets(line, sizeof line, file) != NULL; ++attrcount) { - pch = strtok(line, ","); + for (int attrcount = 0; fgets(buffer, sizeof(buffer), file) != NULL; + ++attrcount) { + pch = strtok(buffer, ","); for (int ind = 0; pch != NULL; ++ind) { strview_t ss = strview(pch, '\0'); pch = strtok(NULL, ",");