From: Tony Cook Date: Fri, 24 May 2013 13:09:03 +0000 (+1000) Subject: [rt #69243] use names instead of ST(n) for i_new_fill_image() and magic X-Git-Tag: v0.96_01~16^2~4 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/c0f387794959a68a5e6d618b2ead38efbe9eb5f5 [rt #69243] use names instead of ST(n) for i_new_fill_image() and magic code checked SvOK() without SvGETMAGIC() --- diff --git a/Imager.xs b/Imager.xs index 1b2f5622..3bd32ab2 100644 --- a/Imager.xs +++ b/Imager.xs @@ -3864,8 +3864,9 @@ i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch_sv, dx, dy) RETVAL Imager::FillHandle -i_new_fill_image(src, matrix, xoff, yoff, combine) +i_new_fill_image(src, matrix_sv, xoff, yoff, combine) Imager::ImgRaw src + SV *matrix_sv i_img_dim xoff i_img_dim yoff int combine @@ -3877,13 +3878,14 @@ i_new_fill_image(src, matrix, xoff, yoff, combine) SV *sv1; int i; CODE: - if (!SvOK(ST(1))) { + SvGETMAGIC(matrix_sv); + if (!SvOK(matrix_sv)) { matrixp = NULL; } else { - if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV) - croak("i_new_fill_image: parameter must be an arrayref"); - av=(AV*)SvRV(ST(1)); + if (!SvROK(matrix_sv) || SvTYPE(SvRV(matrix_sv)) != SVt_PVAV) + croak("i_new_fill_image: matrix parameter must be an arrayref or undef"); + av=(AV*)SvRV(matrix_sv); len=av_len(av)+1; if (len > 9) len = 9;