[gdk-pixbuf] gdip-utils: assert and assume that the module callbacks are non-NULL



commit e8fe9ff11c9c80cd874ceb21461e6e2fa34321bb
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 29 06:57:35 2017 -0600

    gdip-utils: assert and assume that the module callbacks are non-NULL

 gdk-pixbuf/io-gdip-utils.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gdk-pixbuf/io-gdip-utils.c b/gdk-pixbuf/io-gdip-utils.c
index 30028ff59..eccd02455 100644
--- a/gdk-pixbuf/io-gdip-utils.c
+++ b/gdk-pixbuf/io-gdip-utils.c
@@ -551,19 +551,17 @@ destroy_gdipcontext (GdipContext *context)
 static void
 emit_updated (GdipContext *context, GdkPixbuf *pixbuf)
 {
-  if (context->updated_func)
-    (*context->updated_func) (pixbuf,
-                              0, 0,
-                              gdk_pixbuf_get_width (pixbuf),
-                              gdk_pixbuf_get_height (pixbuf),
-                              context->user_data);
+  (*context->updated_func) (pixbuf,
+                            0, 0,
+                            gdk_pixbuf_get_width (pixbuf),
+                            gdk_pixbuf_get_height (pixbuf),
+                            context->user_data);
 }
 
 static void
 emit_prepared (GdipContext *context, GdkPixbuf *pixbuf, GdkPixbufAnimation *anim)
 {
-  if (context->prepared_func)
-    (*context->prepared_func) (pixbuf, anim, context->user_data);
+  (*context->prepared_func) (pixbuf, anim, context->user_data);
 }
 
 static gpointer
@@ -575,6 +573,10 @@ gdk_pixbuf__gdip_image_begin_load (GdkPixbufModuleSizeFunc size_func,
 {
   GdipContext *context = g_new0 (GdipContext, 1);
 
+  g_assert (size_func != NULL);
+  g_assert (prepared_func != NULL);
+  g_assert (updated_func != NULL);
+
   context->size_func     = size_func;
   context->prepared_func = prepared_func;
   context->updated_func  = updated_func;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]