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

Giorgos Keramidas keramida at ceid.upatras.gr
Sun Oct 7 16:43:09 CDT 2007


On 2007-10-07 23:26, Benoit Boissinot <bboissin at gmail.com> 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 ?

Not really, how should I go about testing that this is not a performance
regression?  I ssuspect there's going to be a minor overhead because of
an extra function call for the free() I added, but it would be nice to
be able to produce useful performance test results.

> (I think alloca is defined in stdlib.h in freebsd)

It is, but I can't vouch for its portability on all non-FreeBSD
platforms, and I didn't want to start adding ``ifdef-hell'' parts to
osutil.c if possible :)



More information about the Mercurial-devel mailing list