From 42505e61643a55c437a8cd43e8753129dd9f37ae Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Wed, 22 May 2013 23:38:02 +1000 Subject: [PATCH] [rt #69243] use SysRet for i_addcolors() return value --- Imager.xs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Imager.xs b/Imager.xs index 155e2c5f..b8625cd7 100644 --- 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 +typedef int SysRet; #ifdef IMEXIF_ENABLE #define i_exif_enabled() 1 @@ -3103,11 +3104,10 @@ i_ppal_p(im, l, y, data) OUTPUT: RETVAL -SV * +SysRet i_addcolors(im, ...) Imager::ImgRaw im PREINIT: - int index; i_color *colors; int i; CODE: @@ -3125,17 +3125,7 @@ i_addcolors(im, ...) 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