From ca22b3fefa82596b4388ff6d9bd7d84e6e058973 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 6 Feb 2021 14:57:21 -0800 Subject: [PATCH] remove unnecessary casts of dtmatch() return values These pointers implicitly coerce. --- cmd/tools/gvpack.c | 4 ++-- lib/common/utils.c | 2 +- lib/expr/excc.c | 2 +- lib/expr/exexpr.c | 2 +- lib/expr/exgram.h | 2 +- lib/expr/extoken.c | 2 +- lib/neatogen/multispline.c | 2 +- plugin/core/gvrender_core_json.c | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/tools/gvpack.c b/cmd/tools/gvpack.c index a749b6880..a08f40263 100644 --- a/cmd/tools/gvpack.c +++ b/cmd/tools/gvpack.c @@ -442,7 +442,7 @@ static void fillDict(Dt_t * newdict, Agraph_t* g, int kind) for (a = agnxtattr(g,kind,0); a; a = agnxtattr(g,kind,a)) { name = a->name; value = a->defval; - rv = (attr_t *) dtmatch(newdict, name); + rv = dtmatch(newdict, name); if (!rv) { rv = NEW(attr_t); rv->name = name; @@ -552,7 +552,7 @@ static char *xName(Dt_t * names, char *oldname) pair_t *p; int len; - p = (pair_t *) dtmatch(names, oldname); + p = dtmatch(names, oldname); if (p) { p->cnt++; len = strlen(oldname) + 100; /* 100 for "_gv" and decimal no. */ diff --git a/lib/common/utils.c b/lib/common/utils.c index e95721383..aea88b4f4 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -1078,7 +1078,7 @@ static item *mapEdge(Dt_t * map, edge_t * e) key[0] = agtail(e); key[1] = aghead(e); - return (item *) dtmatch(map, &key); + return dtmatch(map, &key); } /* checkCompound: diff --git a/lib/expr/excc.c b/lib/expr/excc.c index 7e5f83b0e..0a179dfc2 100644 --- a/lib/expr/excc.c +++ b/lib/expr/excc.c @@ -698,7 +698,7 @@ excc(Excc_t* cc, const char* name, Exid_t* sym, int type) if (!cc) return -1; if (!sym) - sym = name ? (Exid_t*)dtmatch(cc->expr->symbols, name) : &cc->expr->main; + sym = name ? dtmatch(cc->expr->symbols, name) : &cc->expr->main; if (sym && sym->lex == PROCEDURE && sym->value) { t = extype(type); diff --git a/lib/expr/exexpr.c b/lib/expr/exexpr.c index 791ff5382..6f6c6d7c4 100644 --- a/lib/expr/exexpr.c +++ b/lib/expr/exexpr.c @@ -29,7 +29,7 @@ exexpr(Expr_t* ex, const char* name, Exid_t* sym, int type) if (ex) { if (!sym) - sym = name ? (Exid_t*)dtmatch(ex->symbols, name) : &ex->main; + sym = name ? dtmatch(ex->symbols, name) : &ex->main; if (sym && sym->lex == PROCEDURE && sym->value) { if (type != DELETE_T) diff --git a/lib/expr/exgram.h b/lib/expr/exgram.h index a25802158..37ea76b98 100644 --- a/lib/expr/exgram.h +++ b/lib/expr/exgram.h @@ -629,7 +629,7 @@ qualify(Exref_t* ref, Exid_t* sym) ref = ref->next; sfprintf(expr.program->tmp, "%s.%s", ref->symbol->name, sym->name); s = exstash(expr.program->tmp, NiL); - if (!(x = (Exid_t*)dtmatch(expr.program->symbols, s))) + if (!(x = dtmatch(expr.program->symbols, s))) { if ((x = newof(0, Exid_t, 1, strlen(s) - EX_NAMELEN + 1))) { diff --git a/lib/expr/extoken.c b/lib/expr/extoken.c index 37e55f9d3..22f0dc593 100644 --- a/lib/expr/extoken.c +++ b/lib/expr/extoken.c @@ -638,7 +638,7 @@ extoken_fn(Expr_t* ex) s = exstash(ex->tmp, NiL); /* v = expr.declare ? dtview(ex->symbols, NiL) : (Dt_t*)0; FIX */ v = (Dt_t*)0; - exlval.id = (Exid_t*)dtmatch(ex->symbols, s); + exlval.id = dtmatch(ex->symbols, s); if (v) dtview(ex->symbols, v); if (!exlval.id) diff --git a/lib/neatogen/multispline.c b/lib/neatogen/multispline.c index d845b178d..205a9cea7 100644 --- a/lib/neatogen/multispline.c +++ b/lib/neatogen/multispline.c @@ -210,7 +210,7 @@ static void vmapAdd(Dt_t * map, int i, int j) static int vMap(Dt_t * map, int i) { Ipair *ip; - ip = (Ipair *) dtmatch(map, &i); + ip = dtmatch(map, &i); return ip->j; } diff --git a/plugin/core/gvrender_core_json.c b/plugin/core/gvrender_core_json.c index e53c4c239..48780bc30 100644 --- a/plugin/core/gvrender_core_json.c +++ b/plugin/core/gvrender_core_json.c @@ -643,14 +643,14 @@ static Dtdisc_t intDisc = { static int lookup (Dt_t* map, char* name) { - intm* ip = (intm*)dtmatch(map, name); + intm* ip = dtmatch(map, name); if (ip) return ip->v; else return -1; } static void insert (Dt_t* map, char* name, int v) { - intm* ip = (intm*)dtmatch(map, name); + intm* ip = dtmatch(map, name); if (ip) { if (ip->v != v) -- 2.40.0