]> git.imager.perl.org - imager.git/commitdiff
add assertions for callers to i_new_hatch_low() in fills.c
authorTony Cook <tony@develop-help.com>
Sat, 2 Feb 2019 01:28:02 +0000 (12:28 +1100)
committerTony Cook <tony@develop-help.com>
Sat, 2 Feb 2019 01:28:02 +0000 (12:28 +1100)
coverity complained that effectively both fg and ffg could be NULL
which isn't the case.  Try to let it know better.

I'm going to rearrange i_new_hatch_low() in the next commit.

CID 185339.

fills.c

diff --git a/fills.c b/fills.c
index 479f9d49f4cfdb43c14894b867de810972b45d47..4754e265925f7e3ea6caf18f4023654502e6c720 100644 (file)
--- a/fills.c
+++ b/fills.c
@@ -1,6 +1,7 @@
 #define IMAGER_NO_CONTEXT
 #include "imager.h"
 #include "imageri.h"
+#include <assert.h>
 
 /*
 =head1 NAME
@@ -436,6 +437,8 @@ with the side of a filled area.
 i_fill_t *
 i_new_fill_hatch(const i_color *fg, const i_color *bg, int combine, int hatch, 
             const unsigned char *cust_hatch, i_img_dim dx, i_img_dim dy) {
+  assert(fg);
+  assert(bg);
   return i_new_hatch_low(fg, bg, NULL, NULL, combine, hatch, cust_hatch, 
                          dx, dy);
 }
@@ -464,6 +467,8 @@ with the side of a filled area.
 i_fill_t *
 i_new_fill_hatchf(const i_fcolor *fg, const i_fcolor *bg, int combine, int hatch, 
                  const unsigned char *cust_hatch, i_img_dim dx, i_img_dim dy) {
+  assert(fg);
+  assert(bg);
   return i_new_hatch_low(NULL, NULL, fg, bg, combine, hatch, cust_hatch, 
                          dx, dy);
 }