[rt #69243] use names for i_tags_addn() instead of ST(n) and handle magic
authorTony Cook <tony@develop-help.com>
Fri, 24 May 2013 13:04:05 +0000 (23:04 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 24 May 2013 13:04:05 +0000 (23:04 +1000)
The code checked SvOK() without SvGETMAGIC()

Imager.xs

index 53e9185..3dc6d0b 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -3630,16 +3630,18 @@ i_img_to_drgb(im)
        Imager::ImgRaw im
 
 undef_int
-i_tags_addn(im, name, code, idata)
+i_tags_addn(im, name_sv, code, idata)
         Imager::ImgRaw im
+       SV *name_sv
         int     code
         int     idata
       PREINIT:
         char *name;
         STRLEN len;
       CODE:
-        if (SvOK(ST(1)))
-          name = SvPV(ST(1), len);
+        SvGETMAGIC(name_sv);
+        if (SvOK(name_sv))
+          name = SvPV_nomg(name_sv, len);
         else
           name = NULL;
         RETVAL = i_tags_addn(&im->tags, name, code, idata);