]> granicus.if.org Git - graphviz/commitdiff
smyrna update_columns: fix incorrect call to initGrid
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 10 Sep 2021 04:31:02 +0000 (21:31 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 16 Sep 2021 04:31:00 +0000 (21:31 -0700)
Thanks to backwards compatibility with K&R C, a function declared with no
parameter list takes an unspecified number of parameters. So it is legal to call
such a function with any arguments. Nevertheless on macOS Clang notices:

  tvnodes.c:354:18: warning: too many arguments in call to 'initGrid'

as noted by Stephen.¹ This commit both fixes the call and alters `initGrid` to
have a more strict signature. This appears to be the correct fix to me as `str`
is duped into `g->flds` below this which is what I think the mistaken call to
`initGrid` believed was happening inside `initGrid`.

¹ https://forum.graphviz.org/t/tracking-down-warnings-old-news-to-some-of-you/821

cmd/smyrna/tvnodes.c

index 16428d0c9f9c5fdfb46b764f2a4938dbc960c969..79abaf35b67ad3c727d175c93fe1da8a85212dbf 100644 (file)
@@ -330,7 +330,7 @@ static void clearGrid(grid * g)
     g->flds = 0;
 }
 
-static grid *initGrid()
+static grid *initGrid(void)
 {
     grid *gr = NEW(grid);
     gr->columns = NULL;
@@ -351,7 +351,7 @@ static grid *update_columns(grid * g, char *str)
        else
            return g;
     } else
-       g = initGrid(str);
+       g = initGrid();
     add_column(g, Name, 0, G_TYPE_STRING);
     if (!str)
        return g;