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

index 758f3a1..38a3b39 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -3178,18 +3178,13 @@ undef_neg_int
 i_maxcolors(im)
         Imager::ImgRaw im
 
-SV *
+i_palidx
 i_findcolor(im, color)
         Imager::ImgRaw im
         Imager::Color color
-      PREINIT:
-        i_palidx index;
       CODE:
-        if (i_findcolor(im, color, &index)) {
-          RETVAL = newSViv(index);
-        }
-        else {
-          RETVAL = &PL_sv_undef;
+        if (!i_findcolor(im, color, &RETVAL)) {
+         XSRETURN_UNDEF;
         }
       OUTPUT:
         RETVAL