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



commit cfb2f43e9f8e89004fd9cb5a581357ce3eb79a7b
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Nov 28 19:16:36 2017 -0600

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

 gdk-pixbuf/io-icns.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/gdk-pixbuf/io-icns.c b/gdk-pixbuf/io-icns.c
index b832c761c..bee669b8b 100644
--- a/gdk-pixbuf/io-icns.c
+++ b/gdk-pixbuf/io-icns.c
@@ -399,6 +399,10 @@ gdk_pixbuf__icns_image_begin_load (GdkPixbufModuleSizeFunc      size_func,
 {
   IcnsProgressiveState *context;
 
+  g_assert (size_func != NULL);
+  g_assert (prepared_func != NULL);
+  g_assert (updated_func != NULL);
+
   context = g_new0 (IcnsProgressiveState, 1);
   context->size_func = size_func;
   context->prepared_func = prepared_func;
@@ -461,23 +465,20 @@ gdk_pixbuf__icns_image_load_increment (gpointer       data,
   w = gdk_pixbuf_get_width (context->pixbuf);
   h = gdk_pixbuf_get_height (context->pixbuf);
 
-  if (context->size_func != NULL)
-    (*context->size_func) (&w,
-                          &h,
-                          context->user_data);
-
-  if (context->prepared_func != NULL)
-    (*context->prepared_func) (context->pixbuf,
-                              NULL,
-                              context->user_data);
-
-  if (context->updated_func != NULL)
-    (*context->updated_func) (context->pixbuf,
-                             0,
-                             0,
-                             gdk_pixbuf_get_width (context->pixbuf),
-                             gdk_pixbuf_get_height (context->pixbuf),
-                             context->user_data);
+  (*context->size_func) (&w,
+                        &h,
+                        context->user_data);
+
+  (*context->prepared_func) (context->pixbuf,
+                            NULL,
+                            context->user_data);
+
+  (*context->updated_func) (context->pixbuf,
+                           0,
+                           0,
+                           gdk_pixbuf_get_width (context->pixbuf),
+                           gdk_pixbuf_get_height (context->pixbuf),
+                           context->user_data);
 
   return TRUE;
 }


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