From: Matthew Fernandez Date: Sat, 5 Nov 2022 03:28:11 +0000 (-0700) Subject: smyrna: remove shadowing of 'grid' X-Git-Tag: 7.0.2~18^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7590e36dd22dd7e7f0efe6cf6b5b420b0459fa66;p=graphviz smyrna: remove shadowing of 'grid' This squashes the compiler warning: tvnodes.c: In function ‘populate_data’: tvnodes.c:195:48: warning: declaration of ‘grid’ shadows a global declaration [-Wshadow] 195 | static void populate_data(Agraph_t * g, grid * grid) | ~~~~~~~^~~~ tvnodes.c:32:3: note: shadowed declaration is here 32 | } grid; | ^~~~ This seems a little overly prescriptive – one `grid` was a type and the other was a value – but maybe the compiler is concerned that a future introduction of a `sizeof(grid)` call in `populate_data` would be ambiguous. --- diff --git a/cmd/smyrna/tvnodes.c b/cmd/smyrna/tvnodes.c index bca442f13..220338831 100644 --- a/cmd/smyrna/tvnodes.c +++ b/cmd/smyrna/tvnodes.c @@ -29,7 +29,7 @@ typedef struct { GtkTreeStore *store; char *flds; char *buf; -} grid; +} grid_t; static char* ID = "ID"; static char* Name = "Name"; @@ -192,8 +192,7 @@ static void create_toggle_column(char *Title, GtkTreeView * tree, int asso, } -static void populate_data(Agraph_t * g, grid * grid) -{ +static void populate_data(Agraph_t *g, grid_t *grid) { Agnode_t *v; int id = 0; GtkTreeIter iter; @@ -271,8 +270,7 @@ static void create_column(gridCol * c, GtkTreeView * tree, int id) } } -static GtkTreeView *update_tree(GtkTreeView * tree, grid * g) -{ +static GtkTreeView *update_tree(GtkTreeView *tree, grid_t *g) { GtkTreeStore *store = NULL; GtkTreeViewColumn *column; @@ -307,7 +305,7 @@ static GtkTreeView *update_tree(GtkTreeView * tree, grid * g) return tree; } -static void add_column(grid *g, strview_t name, bool editable, GType g_type) { +static void add_column(grid_t *g, strview_t name, bool editable, GType g_type) { if (strview_str_eq(name, "")) return; assert(g->count >= 0); @@ -319,8 +317,7 @@ static void add_column(grid *g, strview_t name, bool editable, GType g_type) { g->count++; } -static void clearGrid(grid * g) -{ +static void clearGrid(grid_t * g) { int id; for (id = 0; id < g->count; id++) { free(g->columns[id].name); @@ -332,17 +329,15 @@ static void clearGrid(grid * g) g->flds = 0; } -static grid *initGrid(void) -{ - grid *gr = gv_alloc(sizeof(grid)); +static grid_t *initGrid(void) { + grid_t *gr = gv_alloc(sizeof(grid_t)); gr->columns = NULL; gr->count = 0; gr->buf = 0; return gr; } -static grid *update_columns(grid * g, char *str) -{ +static grid_t *update_columns(grid_t *g, char *str) { if (g) { if (g->flds != str) clearGrid(g); @@ -370,7 +365,7 @@ void setup_tree(Agraph_t * g) G_TYPE_BOOLEAN: */ static GtkTreeView *tree; - static grid *gr; + static grid_t *gr; char *buf = agget(g, "datacolumns"); gr = update_columns(gr, buf);