remove unnecessary casts of dtmatch() return values
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 6 Feb 2021 22:57:21 +0000 (14:57 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 14 Feb 2021 02:30:50 +0000 (18:30 -0800)
These pointers implicitly coerce.

cmd/tools/gvpack.c
lib/common/utils.c
lib/expr/excc.c
lib/expr/exexpr.c
lib/expr/exgram.h
lib/expr/extoken.c
lib/neatogen/multispline.c
plugin/core/gvrender_core_json.c

index a749b68800b8f5c1a45ba321cf6739f067af0eb0..a08f40263d8f59b1e193f8533c94d656568a761a 100644 (file)
@@ -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. */
index e9572138342d2f768e4429872822b66754b55482..aea88b4f4f14e8b9323a434305fccc37efa9312e 100644 (file)
@@ -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:
index 7e5f83b0ee692e4611ddf7cf2f39c1c0d333667b..0a179dfc2b7d7c7c5c31fb301b2f4124c2fdfbc2 100644 (file)
@@ -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);
index 791ff538206ddd84aa2133b2dfae9e7266235173..6f6c6d7c45039d44d344dca6b2606dc9fac793d0 100644 (file)
@@ -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)
index a25802158f0f7ccda33404b91b097cf4f310c619..37ea76b98b6fa081679350b7dc08d27a109ab4af 100644 (file)
@@ -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)))
                {
index 37e55f9d3db14006488f4e48190785a485db6cc7..22f0dc59358ba25f8c8a6d6f63a185022b2cdbc2 100644 (file)
@@ -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)
index d845b178dc840a6d2f92f2ad074ae45764461405..205a9cea704cf917cd86e9d76dc8910701a6ee46 100644 (file)
@@ -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;
 }
 
index e53c4c23907c02bee3ef88a020d7e74d189f6bd1..48780bc303189a19a32324d7933108ee4c0f3bc7 100644 (file)
@@ -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)