]> granicus.if.org Git - graphviz/commitdiff
smyrna: remove 'line' shadowing in 'load_attr_list'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 3 Nov 2022 02:25:13 +0000 (19:25 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 4 Nov 2022 01:14:25 +0000 (18:14 -0700)
Squashes a compiler warning:

  gui/frmobjectui.c:580:10: warning: declaration of ‘line’ shadows a global
    declaration [-Wshadow]
    580 |     char line[BUFSIZ];
        |          ^~~~
  In file included from ./smyrnadefs.h:27,
                   from gui/gui.h:13,
                   from gui/frmobjectui.c:15:
  ../../lib/glcomp/glutils.h:25:7: note: shadowed declaration is here
     25 |     } line;
        |       ^~~~

cmd/smyrna/gui/frmobjectui.c

index e267c6f0d210001bdf3fa595a0d005b02061b838..d8f2baa3de25b2fd666060836e4cb23a6349214a 100644 (file)
@@ -577,7 +577,7 @@ attr_list *load_attr_list(Agraph_t * g)
     attr_list *l;
     FILE *file;
     Agsym_t *sym;              /*cgraph atttribute */
-    char line[BUFSIZ];
+    char buffer[BUFSIZ];
     static char *smyrna_attrs;
     char *a;
 
@@ -588,10 +588,10 @@ attr_list *load_attr_list(Agraph_t * g)
     file = fopen(smyrna_attrs, "r");
     if (file != NULL) {
        int i = 0;
-       while (fgets(line, BUFSIZ, file) != NULL) {
+       while (fgets(buffer, sizeof(buffer), file) != NULL) {
            int idx = 0;
            attr = new_attr();
-           a = strtok(line, ",");
+           a = strtok(buffer, ",");
            attr->index = i;
            attr->type = get_attr_data_type(a[0]);
            while ((a = strtok(NULL, ","))) {