From 6ed5a742296e7c6d516fa76801cdfa1494413607 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 22 Oct 2022 13:43:38 -0700 Subject: [PATCH] graphml2gv: remove 'nameMap' This dictionary was only ever inserted to by code that was removed in the previous commit as unreachable. So we know it is always empty and lookups into it would have always returned null. Gitlab: #2300 --- cmd/tools/graphml2gv.c | 47 ------------------------------------------ 1 file changed, 47 deletions(-) diff --git a/cmd/tools/graphml2gv.c b/cmd/tools/graphml2gv.c index 601763568..90f265561 100644 --- a/cmd/tools/graphml2gv.c +++ b/cmd/tools/graphml2gv.c @@ -89,7 +89,6 @@ typedef struct { gv_stack_t elements; int closedElementType; int edgeinverted; - Dt_t *nameMap; } userdata_t; static Agraph_t *root; /* root graph */ @@ -100,34 +99,6 @@ static Agedge_t *E; /* Set if Current_class == TAG_EDGE */ static gv_stack_t Gstack; -typedef struct { - Dtlink_t link; - char *name; - char *unique_name; -} namev_t; - -static namev_t *make_nitem(Dt_t * d, namev_t * objp, Dtdisc_t * disc) -{ - namev_t *np = gv_alloc(sizeof(*np)); - np->name = objp->name; - np->unique_name = 0; - return np; -} - -static void free_nitem(Dt_t * d, namev_t * np, Dtdisc_t * disc) -{ - free(np->unique_name); - free(np); -} - -static Dtdisc_t nameDisc = { - .key = offsetof(namev_t, name), - .size = -1, - .link = offsetof(namev_t, link), - .makef = (Dtmake_f)make_nitem, - .freef = (Dtfree_f)free_nitem, -}; - static userdata_t *genUserdata(char* dfltname) { userdata_t *user = gv_alloc(sizeof(*user)); @@ -135,25 +106,15 @@ static userdata_t *genUserdata(char* dfltname) user->closedElementType = TAG_NONE; user->edgeinverted = FALSE; user->gname = dfltname; - user->nameMap = dtopen(&nameDisc, Dtoset); return user; } static void freeUserdata(userdata_t * ud) { - dtclose(ud->nameMap); freeString(&ud->elements); free(ud); } -static char *mapLookup(Dt_t *nm, const char *name) { - namev_t *objp = dtmatch(nm, name); - if (objp) - return objp->unique_name; - else - return 0; -} - static int isAnonGraph(const char *name) { if (*name++ != '%') return 0; @@ -343,14 +304,6 @@ startElementHandler(void *userData, const char *name, const char **atts) if (pos > 0) head = atts[pos]; - tname = mapLookup(ud->nameMap, tail); - if (tname) - tail = tname; - - tname = mapLookup(ud->nameMap, head); - if (tname) - head = tname; - if (G == 0) fprintf(stderr,"edge source %s target %s outside graph, ignored\n",tail,head); else { -- 2.40.0