]> granicus.if.org Git - graphviz/commitdiff
remove unnecessary casts of allocation results in mklang.y
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 4 Jun 2021 00:22:20 +0000 (17:22 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Jun 2021 14:18:52 +0000 (07:18 -0700)
This input is only used to generate a C file. In C, void pointers (as are the
results of all the allocation functions) implicitly coerce to all other pointer
types.

doc/infosrc/mklang.y

index 68b7916797469a98034847cb8d14f0ef8eb66d34..59beba724144c5fc1ab73e204218f9121dd23c76 100644 (file)
@@ -45,7 +45,7 @@ gen (char* name, term_t* ts)
 static term_t*
 mkLiteral (char c, int kind)
 {
-    term_t* nt = (term_t*)malloc(sizeof(term_t));
+    term_t* nt = malloc(sizeof(term_t));
     nt->kind = kind;
     nt->u.c = c;
     nt->next = 0;
@@ -55,7 +55,7 @@ mkLiteral (char c, int kind)
 static term_t*
 mkID (char* s, int kind)
 {
-    term_t* nt = (term_t*)malloc(sizeof(term_t));
+    term_t* nt = malloc(sizeof(term_t));
     nt->kind = kind;
     nt->u.s = s;
     nt->next = 0;
@@ -65,7 +65,7 @@ mkID (char* s, int kind)
 static term_t*
 mkSeq (term_t* t1, term_t* t2, int kind)
 {
-    term_t* nt = (term_t*)malloc(sizeof(term_t));
+    term_t* nt = malloc(sizeof(term_t));
     nt->kind = kind;
     nt->u.t = t1;
     t1->next = t2;
@@ -76,7 +76,7 @@ mkSeq (term_t* t1, term_t* t2, int kind)
 static term_t*
 mkTerm (term_t* t, int kind)
 {
-    term_t* nt = (term_t*)malloc(sizeof(term_t));
+    term_t* nt = malloc(sizeof(term_t));
     nt->kind = kind;
     nt->u.t = t;
     nt->next = 0;