[gdk-pixbuf] Avoid a compiler warning



commit c975e024efe3ce4811c167d66a8cb4e1627adcc0
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Apr 26 11:12:07 2018 +0100

    Avoid a compiler warning
    
    If there are no built-in modules, the `builtin_module` variable is not
    used, and the compiler will warn about it.
    
    Since we're already using the variable inside a macro, we can just
    declare it inside the macro block and save us the trouble altogether.

 gdk-pixbuf/gdk-pixbuf-io.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 75fa26a..0c8e7d6 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -399,20 +399,14 @@ gdk_pixbuf_io_init (void)
         GdkPixbufModulePattern *pattern;
         GError *error = NULL;
 #endif
-        GdkPixbufModule *builtin_module ;
 
-        /*  initialize on separate line to avoid compiler warnings in the
-         *  common case of no compiled-in modules.
-         */
-        builtin_module = NULL;
-
-#define load_one_builtin_module(format)                                 \
-        builtin_module = g_new0 (GdkPixbufModule, 1);                   \
-        builtin_module->module_name = #format;                          \
-        if (gdk_pixbuf_load_module_unlocked (builtin_module, NULL))             \
-                file_formats = g_slist_prepend (file_formats, builtin_module);\
-        else                                                            \
-                g_free (builtin_module)
+#define load_one_builtin_module(format)                                 G_STMT_START { \
+        GdkPixbufModule *__builtin_module = g_new0 (GdkPixbufModule, 1);               \
+        __builtin_module->module_name = #format;                                       \
+        if (gdk_pixbuf_load_module_unlocked (__builtin_module, NULL))                  \
+                file_formats = g_slist_prepend (file_formats, __builtin_module);       \
+        else                                                                           \
+                g_free (__builtin_module);                              } G_STMT_END
 
 #ifdef INCLUDE_ani
         load_one_builtin_module (ani);


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