Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!apollo!vinoski From: vinoski@apollo.HP.COM (Stephen Vinoski) Newsgroups: comp.lang.perl Subject: unofficial malloc.c patch Message-ID: <510dac0c.20b6d@apollo.HP.COM> Date: 18 Apr 91 21:18 GMT Sender: root@apollo.HP.COM Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 67 After applying the new patches for Perl 4.0 I still had trouble building on my Apollo DN3500 using cc 6.8. The ANSI C compiler doesn't like the function parameter mismatches for free() and realloc(). I suspect other systems will have the same problem, so I have included an unofficial patch to correct the problem. Also, Configure incorrectly guessed that our malloc() returns char * when it really returns void *. Nothing my editor couldn't fix, though. -steve *** malloc.c.broken Thu Apr 18 14:26:47 1991 --- malloc.c Thu Apr 18 14:28:31 1991 *************** *** 108,115 **** --- 108,119 ---- #endif MALLOCPTRTYPE * + #ifdef __STDC__ + malloc(size_t nbytes) + #else malloc(nbytes) register unsigned nbytes; + #endif { register union overhead *p; register int bucket = 0; *************** *** 230,237 **** --- 234,245 ---- } void + #ifdef __STDC__ + free(void *cp) + #else free(cp) char *cp; + #endif { register int size; register union overhead *op; *************** *** 277,285 **** --- 285,297 ---- int reall_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ MALLOCPTRTYPE * + #ifdef __STDC__ + realloc(void *cp, size_t nbytes) + #else realloc(cp, nbytes) char *cp; unsigned nbytes; + #endif { register u_int onb; union overhead *op; | Steve Vinoski (508)256-0176 x5904 | Internet: vinoski@apollo.hp.com | | HP Apollo Division, Chelmsford, MA 01824 | UUCP: ...!apollo!vinoski | | "The price of knowledge is learning how little of it you yourself harbor." | | - Tom Christiansen |