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



commit 6f986ba6ccb6a9bb17f18eddc99b613e12c4a31a
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Nov 28 19:22:58 2017 -0600

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

 gdk-pixbuf/io-xbm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c
index e6fa4c019..20fbfadc9 100644
--- a/gdk-pixbuf/io-xbm.c
+++ b/gdk-pixbuf/io-xbm.c
@@ -342,7 +342,7 @@ gdk_pixbuf__xbm_image_load_real (FILE     *f,
        pixels = gdk_pixbuf_get_pixels (pixbuf);
        row_stride = gdk_pixbuf_get_rowstride (pixbuf);
 
-       if (context && context->prepare_func)
+       if (context)
                (* context->prepare_func) (pixbuf, NULL, context->user_data);
 
 
@@ -371,8 +371,7 @@ gdk_pixbuf__xbm_image_load_real (FILE     *f,
        g_free (data);
 
        if (context) {
-               if (context->update_func)
-                       (* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
+               (* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
        }
 
        return pixbuf;
@@ -406,6 +405,10 @@ gdk_pixbuf__xbm_image_begin_load (GdkPixbufModuleSizeFunc       size_func,
        XBMData *context;
        gint fd;
 
+       g_assert (size_func != NULL);
+       g_assert (prepare_func != NULL);
+       g_assert (update_func != NULL);
+
        context = g_new (XBMData, 1);
        context->prepare_func = prepare_func;
        context->update_func = update_func;


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