From f6f6cdd3074c127a4b9cd87c4fa6ab85992e788e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 3 Jun 2021 17:23:30 -0700 Subject: [PATCH] remove unnecessary casts of allocation function results in grammar.y This input is only used to generate a parser in C. In C, void pointers (as are the results of all the allocation functions) implicitly coerce to all other pointer types. --- lib/cgraph/grammar.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cgraph/grammar.y b/lib/cgraph/grammar.y index bfa677345..9dd2a36c8 100644 --- a/lib/cgraph/grammar.y +++ b/lib/cgraph/grammar.y @@ -442,7 +442,7 @@ concat (char* s1, char* s2) size_t len = strlen(s1) + strlen(s2) + 1; if (len <= BUFSIZ) sym = buf; - else sym = (char*)malloc(len); + else sym = malloc(len); strcpy(sym,s1); strcat(sym,s2); s = agstrdup (G,sym); @@ -463,7 +463,7 @@ concatPort (char* s1, char* s2) size_t len = strlen(s1) + strlen(s2) + 2; /* one more for ':' */ if (len <= BUFSIZ) sym = buf; - else sym = (char*)malloc(len); + else sym = malloc(len); sprintf (sym, "%s:%s", s1, s2); s = agstrdup (G,sym); agstrfree (G,s1); -- 2.50.1