[gegl] operations/external/raw-load: Set user_data as soon as it is allocated



commit 3f1dc380ccf0fe9f697e7dabc1e8e93f923bc953
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Feb 4 01:47:54 2017 +0100

    operations/external/raw-load: Set user_data as soon as it is allocated
    
    The value of user_data should always be the address to the Private
    struct. There is no reason not to set it as soon as the struct has been
    allocated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778160

 operations/external/raw-load.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/operations/external/raw-load.c b/operations/external/raw-load.c
index f0d0482..a2e86a8 100644
--- a/operations/external/raw-load.c
+++ b/operations/external/raw-load.c
@@ -78,7 +78,10 @@ prepare (GeglOperation *operation)
   int         ret;
 
   if (p == NULL)
-    p = g_new0(Private, 1);
+    {
+      p = g_new0(Private, 1);
+      o->user_data = (gpointer)p;
+    }
 
   if (p->cached_path && !strcmp (p->cached_path, o->path))
   {
@@ -87,7 +90,6 @@ prepare (GeglOperation *operation)
 
   if (p->LibRaw == NULL)
     {
-      o->user_data = (gpointer)p;
       p->image = NULL;
 
       if ((p->LibRaw = libraw_init(LIBRAW_OPTIONS_NONE)) == NULL)


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