From owner-freebsd-hackers Thu Aug 20 14:58:33 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA03987 for freebsd-hackers-outgoing; Thu, 20 Aug 1998 14:58:33 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp02.primenet.com (smtp02.primenet.com [206.165.6.132]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA03981 for ; Thu, 20 Aug 1998 14:58:32 -0700 (PDT) (envelope-from tlambert@usr04.primenet.com) Received: (from daemon@localhost) by smtp02.primenet.com (8.8.8/8.8.8) id OAA11232; Thu, 20 Aug 1998 14:57:52 -0700 (MST) Received: from usr04.primenet.com(206.165.6.204) via SMTP by smtp02.primenet.com, id smtpd011194; Thu Aug 20 14:57:43 1998 Received: (from tlambert@localhost) by usr04.primenet.com (8.8.5/8.8.5) id OAA27564; Thu, 20 Aug 1998 14:57:43 -0700 (MST) From: Terry Lambert Message-Id: <199808202157.OAA27564@usr04.primenet.com> Subject: Re: Realloc fix for review To: imp@village.org (Warner Losh) Date: Thu, 20 Aug 1998 21:57:42 +0000 (GMT) Cc: hackers@FreeBSD.ORG In-Reply-To: <199808201619.KAA20970@harmony.village.org> from "Warner Losh" at Aug 20, 98 10:19:42 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > So rather than hack some really complicated a and na's, I write a new > function, added it to libc and then modified all of src/lib to use > this new function. I called it frealloc (freeing realloc). I added > it to the man page, etc. I know that this isn't in ANSI C nor in > POSIX, but after seeing how hard it was to get people to use strncpy > right, I thought it would be good to add this to libc. > > I did a full make world, and this seems to work. One gotcha that I > had was that I could not place frealloc into the "logical" place of > malloc.c due to the "emacs malloc" problem that was worked around in > ld.so. It was far easier to place it in its own file than to generate > a working patch for ld.so. It also seems cleaner this way as well > since the code will work with any implementation of > malloc/free/realloc. > > Comments? 1) It should be an inline function in stdlib.h, I think... 2) I suppose you did this so we can easily do a: find /usr/src -name \*.c -print | xargs grep frealloc to find all the code written by people bad at pointer math and thus in need of a pointer code review? 8-). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message