]> granicus.if.org Git - flex/commitdiff
(char*) cast for realloc
authorVern Paxson <vern@ee.lbl.gov>
Mon, 24 Apr 1995 10:48:47 +0000 (10:48 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Mon, 24 Apr 1995 10:48:47 +0000 (10:48 +0000)
flex.skl

index 431b408d3705ebbb8294193b458c673a64b8cc1d..218e6524e2f6ddace30fa0797e206c01de651136 100644 (file)
--- a/flex.skl
+++ b/flex.skl
@@ -1480,7 +1480,14 @@ void *ptr;
 yy_size_t size;
 #endif
        {
-       return (void *) realloc( ptr, size );
+       /* The cast to (char *) in the following accommodates both
+        * implementations that use char* generic pointers, and those
+        * that use void* generic pointers.  It works with the latter
+        * because both ANSI C and C++ allow castless assignment from
+        * any pointer type to void*, and deal with argument conversions
+        * as though doing an assignment.
+        */
+       return (void *) realloc( (char *) ptr, size );
        }
 
 #ifdef YY_USE_PROTOS