]> git.imager.perl.org - imager.git/commitdiff
[rt #69243] use SysRet for i_addcolors() return value
authorTony Cook <tony@develop-help.com>
Wed, 22 May 2013 13:38:02 +0000 (23:38 +1000)
committerTony Cook <tony@develop-help.com>
Wed, 22 May 2013 13:38:02 +0000 (23:38 +1000)
Imager.xs

index 155e2c5f802c4ff393075a9a2f80a5905677f9ee..b8625cd7ace961ffffcd362a8d89a4a264718bab 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -930,6 +930,7 @@ static im_pl_ext_funcs im_perl_funcs =
 
 #define IIM_new i_img_8_new
 #define IIM_DESTROY i_img_destroy
 
 #define IIM_new i_img_8_new
 #define IIM_DESTROY i_img_destroy
+typedef int SysRet;
 
 #ifdef IMEXIF_ENABLE
 #define i_exif_enabled() 1
 
 #ifdef IMEXIF_ENABLE
 #define i_exif_enabled() 1
@@ -3103,11 +3104,10 @@ i_ppal_p(im, l, y, data)
       OUTPUT:
         RETVAL
 
       OUTPUT:
         RETVAL
 
-SV *
+SysRet
 i_addcolors(im, ...)
         Imager::ImgRaw  im
       PREINIT:
 i_addcolors(im, ...)
         Imager::ImgRaw  im
       PREINIT:
-        int index;
         i_color *colors;
         int i;
       CODE:
         i_color *colors;
         int i;
       CODE:
@@ -3125,17 +3125,7 @@ i_addcolors(im, ...)
             croak("i_addcolor: pixels must be Imager::Color objects");
           }
         }
             croak("i_addcolor: pixels must be Imager::Color objects");
           }
         }
-        index = i_addcolors(im, colors, items-1);
-        myfree(colors);
-        if (index == 0) {
-          RETVAL = newSVpv("0 but true", 0);
-        }
-        else if (index == -1) {
-          RETVAL = &PL_sv_undef;
-        }
-        else {
-          RETVAL = newSViv(index);
-        }
+        RETVAL = i_addcolors(im, colors, items-1);
       OUTPUT:
         RETVAL
 
       OUTPUT:
         RETVAL