]> granicus.if.org Git - graphviz/commitdiff
remove unnecessary allocation function result casts in scan.l
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 4 Jun 2021 00:24:33 +0000 (17:24 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Jun 2021 14:18:53 +0000 (07:18 -0700)
This input is only used to create a lexer in C. In C, void pointers (as is the
result of realloc) implicitly coerce to all other pointer types.

lib/cgraph/scan.l

index 723b386d91fdbd3dc09ae54e0e604f64823c1f43..541f4df3ea886f6c314e00874be40da77f92560e 100644 (file)
@@ -85,7 +85,7 @@ static void addstr(char *src) {
                        long    sz = Send - Sbuf;
                        long    off = Sptr - Sbuf;
                        sz *= 2;
-                       Sbuf = (char*)realloc(Sbuf,sz);
+                       Sbuf = realloc(Sbuf,sz);
                        Send = Sbuf + sz;
                        Sptr = Sbuf + off;
                }
@@ -109,7 +109,7 @@ storeFileName (char* fname, int len)
     static char* buf;
 
     if (len > cnt) {
-       buf = (char*)realloc (buf, len+1);
+       buf = realloc (buf, len+1);
        cnt = len;
     }
     strcpy (buf, fname);