[PATCH 2 of 2] osutil.c: replace alloca() with malloc() and remove <alloca.h>

Matt Mackall mpm at selenic.com
Sun Oct 7 21:35:48 UTC 2007


On Sun, Oct 07, 2007 at 11:26:46PM +0200, Benoit Boissinot wrote:
> On 10/7/07, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> > # HG changeset patch
> > # User Giorgos Keramidas <keramida at ceid.upatras.gr>
> > # Date 1191783522 -10800
> > # Node ID 5d13d2d3f42bc150f711bfa3a8bb38a7d0b5c1d4
> > # Parent  37dc732e00416a50dcc9b994961acdb6ceb755ba
> > osutil.c: replace alloca() with malloc() and remove <alloca.h>
> >
> > The <alloca.h> header is not really portable, and it breaks Mercurial on
> > FreeBSD.  Remove the dependency on <alloca.h> and alloca() by replacing
> > the only place where it was used with malloc().
> 
> Have you done a performance test to see wether it has an impact or not ?
> 
> (I think alloca is defined in stdlib.h in freebsd)

It's also worth noting that alloca doesn't require a free while malloc
does.

At the moment, I'm making osutil.c correspond to our C coding style.
Starting with tabs.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list