avoid dead code in i_get_anonymous_color_histo()
authorTony Cook <tony@develop-help.com>
Wed, 2 Jan 2019 07:56:32 +0000 (18:56 +1100)
committerTony Cook <tony@develop-help.com>
Wed, 2 Jan 2019 07:56:32 +0000 (18:56 +1100)
Changes
Imager.xs

diff --git a/Changes b/Changes
index 97c275a..fde0e81 100644 (file)
--- a/Changes
+++ b/Changes
@@ -66,6 +66,9 @@ High severity:
 
  - avoid dead code in i_tt_glyph_names(). CID 185321.
 
+ - avoid dead code in i_get_anonymous_color_histo(), which is the
+   implementation of getcolorusage().  CID 185327.
+
 Imager 1.008 - 31 Dec 2018
 ============
 
index 7f428e3..7017e9a 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -2670,17 +2670,14 @@ i_get_anonymous_color_histo(im, maxc = 0x40000000)
         int col_cnt;
     PPCODE:
        col_cnt = i_get_anonymous_color_histo(im, &col_usage, maxc);
-        if (col_cnt > 0) {
-            EXTEND(SP, col_cnt);
-            for (i = 0; i < col_cnt; i++)  {
-                PUSHs(sv_2mortal(newSViv( col_usage[i])));
-            }
-            myfree(col_usage);
-            XSRETURN(col_cnt);
-        }
-        else {
-            XSRETURN_EMPTY;
+        if (col_cnt <= 0) {
+           XSRETURN_EMPTY;
+       }
+        EXTEND(SP, col_cnt);
+        for (i = 0; i < col_cnt; i++)  {
+            PUSHs(sv_2mortal(newSViv( col_usage[i])));
         }
+        myfree(col_usage);
 
 
 void