in reply to Re: Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!"
in thread Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!"

In your "patch" you used the following code
if ( (unsigned)size > 1000000 ) Perl_croak(aTHX_ "Bugger!\n")
I noticed that the author had a CROAK macro and wondered why you opted for the Perl_croak and what the difference was.
/** Storable.xs 1.0.13 **/ #define CROAK(x) do { cxt->s_dirty = 1; croak x; } while (0)
/** Storable.xs 2.13 **/ #define CROAK(x) STMT_START { cxt->s_dirty = 1; croak x; } STMT +_END
I understand that the cxt->s_dirty is used to let Storable reuse the memory next time around, just wondering what the difference between croak and Perl_croak is.

-biz-

Replies are listed 'Best First'.
Re^3:Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!"
by tachyon (Chancellor) on Oct 27, 2004 at 22:50 UTC

    I was too lazy to look at the syntax of yet another macro. Storable is just one big macro! It is probably better to do:

    if ( (unsigned)size > 1000000 ) CROAK(("Bugger!\n"));

    Note that you need double parenths as the call to croak does not have any! croak is a Perl alias for Perl_croak_nocontext so the call is near identical but you are setting the context to dirty, looking at the source this is caught and cleaned so should fix the leak.

    cheers

    tachyon