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



commit 61188355401795e10f9a47e12519af1a87b82bcc
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 29 06:56:53 2017 -0600

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

 gdk-pixbuf/io-xpm.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c
index 7fc588715..2b8cf7445 100644
--- a/gdk-pixbuf/io-xpm.c
+++ b/gdk-pixbuf/io-xpm.c
@@ -723,6 +723,10 @@ gdk_pixbuf__xpm_image_begin_load (GdkPixbufModuleSizeFunc size_func,
        XPMContext *context;
        gint fd;
 
+       g_assert (size_func != NULL);
+       g_assert (prepare_func != NULL);
+       g_assert (update_func != NULL);
+
        context = g_new (XPMContext, 1);
        context->prepare_func = prepare_func;
        context->update_func = update_func;
@@ -761,16 +765,14 @@ gdk_pixbuf__xpm_image_stop_load (gpointer data,
                pixbuf = gdk_pixbuf__xpm_image_load (context->file, error);
 
                if (pixbuf != NULL) {
-                      if (context->prepare_func)
-                              (* context->prepare_func) (pixbuf,
-                                                         NULL,
-                                                         context->user_data);
-                      if (context->update_func)
-                              (* context->update_func) (pixbuf,
-                                                        0, 0,
-                                                        gdk_pixbuf_get_width (pixbuf),
-                                                        gdk_pixbuf_get_height (pixbuf),
-                                                        context->user_data);
+                      (* context->prepare_func) (pixbuf,
+                                                 NULL,
+                                                 context->user_data);
+                      (* context->update_func) (pixbuf,
+                                                0, 0,
+                                                gdk_pixbuf_get_width (pixbuf),
+                                                gdk_pixbuf_get_height (pixbuf),
+                                                context->user_data);
                        g_object_unref (pixbuf);
 
                        retval = TRUE;


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