Patch to allow more granular aborting.

Theo Schlossnagle jesus at omniti.com
Tue Mar 15 11:23:47 CET 2011


I'm confused now.  In a previous mail, you suggested I use the builtin
libgmp mechanism to replace the allocators.  It appears libgmp indeed
has replaceable allocators, but then when it goes to allocate they are
not used. I results in I me being unable to wrap realloc and throw and
exception on NULL return.

At that point, I'm only left with the replaceable abort that I
proposed originally -- which is quite surgical.

On Tue, Mar 15, 2011 at 2:42 AM, Niels Möller <nisse at lysator.liu.se> wrote:
> Theo Schlossnagle <jesus at omniti.com> writes:
>
>> gmp-impl.h defines:
>>
>> 1753 #define MPZ_REALLOC(z,n) (UNLIKELY ((n) > ALLOC(z))     \
>> 1754                           ? (mp_ptr) _mpz_realloc(z,n)  \
>> 1755                           : PTR(z))
>>
>> which bypasses any replacement of __gmp_reallocate_func.
>
> That's not bypassing it, as far as I can see. If reallocation is needed,
> it calls _mpz_realloc (mpz/realloc.c), which should do the right thing,
>
> Regards,
> /Niels
>
> --
> Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
> Internet email is subject to wholesale government surveillance.
>



-- 
Theo Schlossnagle

http://omniti.com/is/theo-schlossnagle


More information about the gmp-devel mailing list