]> git.imager.perl.org - imager.git/commitdiff
[rt #69243] use names instead of ST(n) for i_new_fill_image() and magic
authorTony Cook <tony@develop-help.com>
Fri, 24 May 2013 13:09:03 +0000 (23:09 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 24 May 2013 13:09:03 +0000 (23:09 +1000)
code checked SvOK() without SvGETMAGIC()

Imager.xs

index 1b2f5622b3c9939faa455f9d06f5b9d04bd8e09a..3bd32ab24cf4982e0d03e2d1af0b1f4259fabd5b 100644 (file)
--- 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
         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
         Imager::ImgRaw src
+       SV *matrix_sv
         i_img_dim xoff
         i_img_dim yoff
         int combine
         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:
         SV *sv1;
         int i;
       CODE:
-        if (!SvOK(ST(1))) {
+        SvGETMAGIC(matrix_sv);
+        if (!SvOK(matrix_sv)) {
           matrixp = NULL;
         }
         else {
           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;
          len=av_len(av)+1;
           if (len > 9)
             len = 9;