Subject: Re: realloc
To: Bill Studenmund <wrstuden@loki.stanford.edu>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 06/03/1996 23:17:12
On Mon, 3 Jun 1996 18:15:54 -0700 (PDT) 
 wrstuden@loki.stanford.edu (Bill Studenmund) wrote:

 > I am trying to port some Mach kernel code (a Mac file system
 > vfs package), and am wondering what to do about some calls
 > in it, namely calles to realloc(existing pointer, new size).
 > Should I just change them to free(existing, M_);
 > malloc(new size, M_, flags)? Or is there a better way?

Well, don't forget to copy the data before free'ing :-)

I haven't really looked at Mach code for a while.  Which version of Mach 
is this VFS for?  It might be relatively easy to port one of the Mach 
realloc's to NetBSD (given that it uses Mach-derived VM).

If it were useful, a real realloc() would be cool, otherwise, writing a 
macfs_realloc() that does the simple ralloc algorithm might be appropriate.

----save the ancient forests - http://www.bayarea.net/~thorpej/forest/----
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939