friedo/perl-api-terror — pull request #1 by bulk88 (2014-07-06 07:49:58+00:00)
Title: fix examples

SvIV is a test of
#define SvIOK_nog(sv)	((SvFLAGS(sv) & (SVf_IOK|SVs_GMG)) == SVf_IOK)
if we check for SvIOK, then use SvIVX directly since that is what will
happen anyway and sv_2iv(), in the macro expansion will never be called

before the croak happens, the AV/HV has to be connected to the GC to be
freed, choices are mortal it, savestack it, or connect it to another
container like a RV/GV/HV/AV, since we do neither, call SvREFCNT_dec_NN
right before we croak to free it

newAV returns a AV with a refcnt of 1, if newRV_inc is called, it will be
bumped to 2, the RV will go back into Inline::C's control, then probably
be mortalized, who owns the other refcnt on the AV? nobody, it was leaked,
so use newRV_noinc

SvPV provides a length, so the strlen is redundant, but sv_2pv_flags
will never be called due to the SvPOK check, so use SvPVX and SvCUR
directly