[gimp] libgimp: make gimp_close() static to gimp.c again



commit e3374e7d4e1c33742e5240704b14d5d5d0a27aa8
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 2 18:44:34 2019 +0200

    libgimp: make gimp_close() static to gimp.c again
    
    Instead of calling _gimp_close() and returning from both the main
    plug-in loop variants, simply only return and call gimp_close() from
    where both loops return to, at the end of gimp_main_internal().

 libgimp/gimp-private.h       |  1 -
 libgimp/gimp.c               | 13 ++++++++-----
 libgimp/gimplegacy.c         |  7 +------
 libgimp/gimpplugin-private.c |  7 +------
 4 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/libgimp/gimp-private.h b/libgimp/gimp-private.h
index d1f6cb7859..d3ecc4ac15 100644
--- a/libgimp/gimp-private.h
+++ b/libgimp/gimp-private.h
@@ -31,7 +31,6 @@ extern GIOChannel *_gimp_readchannel;
 extern GIOChannel *_gimp_writechannel;
 
 
-void   _gimp_close           (void);
 void   _gimp_config          (GPConfig        *config);
 void   _gimp_loop            (GimpRunProc      run_proc);
 void   _gimp_read_expect_msg (GimpWireMessage *msg,
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 21797b4b78..185b7e626a 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -151,6 +151,7 @@ static gint       gimp_main_internal           (GType                 plug_in_ty
                                                 gint                  argc,
                                                 gchar                *argv[]);
 
+static void       gimp_close                   (void);
 static void       gimp_debug_stop              (void);
 static void       gimp_message_func            (const gchar    *log_domain,
                                                 GLogLevelFlags  log_level,
@@ -735,7 +736,7 @@ gimp_main_internal (GType                 plug_in_type,
             PLUG_IN_INFO.query_proc ();
         }
 
-      _gimp_close ();
+      gimp_close ();
 
       return EXIT_SUCCESS;
     }
@@ -755,7 +756,7 @@ gimp_main_internal (GType                 plug_in_type,
             PLUG_IN_INFO.init_proc ();
         }
 
-      _gimp_close ();
+      gimp_close ();
 
       return EXIT_SUCCESS;
     }
@@ -779,6 +780,8 @@ gimp_main_internal (GType                 plug_in_type,
       _gimp_loop (PLUG_IN_INFO.run_proc);
     }
 
+  gimp_close ();
+
   return EXIT_SUCCESS;
 }
 
@@ -791,7 +794,7 @@ gimp_main_internal (GType                 plug_in_type,
 void
 gimp_quit (void)
 {
-  _gimp_close ();
+  gimp_close ();
 
 #if defined G_OS_WIN32 && defined HAVE_EXCHNDL
   if (plug_in_backtrace_path)
@@ -1228,8 +1231,8 @@ gimp_get_progname (void)
 
 /*  private functions  */
 
-void
-_gimp_close (void)
+static void
+gimp_close (void)
 {
   if (gimp_debug_flags & GIMP_DEBUG_QUIT)
     gimp_debug_stop ();
diff --git a/libgimp/gimplegacy.c b/libgimp/gimplegacy.c
index 3ecd2a2ae1..e8ad583ff0 100644
--- a/libgimp/gimplegacy.c
+++ b/libgimp/gimplegacy.c
@@ -955,16 +955,12 @@ _gimp_loop (GimpRunProc run_proc)
   while (TRUE)
     {
       if (! gimp_wire_read_msg (_gimp_readchannel, &msg, NULL))
-        {
-          _gimp_close ();
-          return;
-        }
+        return;
 
       switch (msg.type)
         {
         case GP_QUIT:
           gimp_wire_destroy (&msg);
-          _gimp_close ();
           return;
 
         case GP_CONFIG:
@@ -980,7 +976,6 @@ _gimp_loop (GimpRunProc run_proc)
         case GP_PROC_RUN:
           gimp_proc_run (msg.data, run_proc);
           gimp_wire_destroy (&msg);
-          _gimp_close ();
           return;
 
         case GP_PROC_RETURN:
diff --git a/libgimp/gimpplugin-private.c b/libgimp/gimpplugin-private.c
index 320eae912b..5f0920cf29 100644
--- a/libgimp/gimpplugin-private.c
+++ b/libgimp/gimpplugin-private.c
@@ -169,16 +169,12 @@ gimp_plug_in_loop (GimpPlugIn *plug_in)
       GimpWireMessage msg;
 
       if (! gimp_wire_read_msg (_gimp_readchannel, &msg, NULL))
-        {
-          _gimp_close ();
-          return;
-        }
+        return;
 
       switch (msg.type)
         {
         case GP_QUIT:
           gimp_wire_destroy (&msg);
-          _gimp_close ();
           return;
 
         case GP_CONFIG:
@@ -194,7 +190,6 @@ gimp_plug_in_loop (GimpPlugIn *plug_in)
         case GP_PROC_RUN:
           gimp_plug_in_proc_run (plug_in, msg.data);
           gimp_wire_destroy (&msg);
-          _gimp_close ();
           return;
 
         case GP_PROC_RETURN:


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