[rt #69243] slightly simplify XS for i_gsamp()
authorTony Cook <tony@develop-help.com>
Fri, 24 May 2013 13:01:06 +0000 (23:01 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 24 May 2013 13:01:06 +0000 (23:01 +1000)
Imager.xs

index 38a3b39..18511db 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -3213,7 +3213,7 @@ i_gsamp(im, l, r, y, channels)
         i_img_dim count, i;
       PPCODE:
         if (l < r) {
-          data = mymalloc(sizeof(i_sample_t) * (r-l) * channels.count); /* XXX: memleak? */
+          data = mymalloc(sizeof(i_sample_t) * (r-l) * channels.count);
           count = i_gsamp(im, l, r, y, data, channels.channels, channels.count);
           if (GIMME_V == G_ARRAY) {
             EXTEND(SP, count);
@@ -3228,8 +3228,7 @@ i_gsamp(im, l, r, y, channels)
         }
         else {
           if (GIMME_V != G_ARRAY) {
-            EXTEND(SP, 1);
-            PUSHs(&PL_sv_undef);
+           XSRETURN_UNDEF;
           }
         }