[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Factorize "free()" code

Jérôme Guelfucci noreply at xfce.org
Thu Jun 17 23:30:04 CEST 2010


Updating branch refs/heads/xrandr-display-settings
         to 6def50d3263863ffe1557a4eb4b196f47b26b1bb (commit)
       from 49f2d9a21d009622748afd559f2fe473d28f2c7d (commit)

commit 6def50d3263863ffe1557a4eb4b196f47b26b1bb
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Thu Jun 17 23:08:14 2010 +0200

    Factorize "free()" code

 dialogs/display-settings/xfce-randr.c |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index 129c6e4..b2d4189 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -197,6 +197,7 @@ xfce_randr_populate (XfceRandr *randr,
                                                              root_window, n);
     }
 
+    /* clone modes: same RRModes present for all outputs */
     xfce_randr_get_clone_modes (randr);
 
     return TRUE;
@@ -263,8 +264,8 @@ xfce_randr_new (GdkDisplay  *display,
 
 
 
-void
-xfce_randr_free (XfceRandr *randr)
+static void
+xfce_randr_cleanup (XfceRandr *randr)
 {
     gint n;
 
@@ -285,6 +286,14 @@ xfce_randr_free (XfceRandr *randr)
     g_free (randr->status);
     g_free (randr->position);
     g_free (randr->output_info);
+}
+
+
+
+void
+xfce_randr_free (XfceRandr *randr)
+{
+    xfce_randr_cleanup (randr);
 
     /* free the structure */
     g_slice_free (XfceRandr, randr);
@@ -295,27 +304,10 @@ xfce_randr_free (XfceRandr *randr)
 void
 xfce_randr_reload (XfceRandr *randr)
 {
-    gint       n;
     Display   *xdisplay;
     GdkWindow *root_window;
 
-    /* free the output info cache */
-    for (n = 0; n < randr->resources->noutput; n++)
-        if (G_LIKELY (randr->output_info[n]))
-            XRRFreeOutputInfo (randr->output_info[n]);
-
-    /* free the screen resources */
-    XRRFreeScreenResources (randr->resources);
-
-    /* free the settings */
-    g_free (randr->clone_modes);
-    g_free (randr->mode);
-    g_free (randr->preferred_mode);
-    g_free (randr->rotation);
-    g_free (randr->rotations);
-    g_free (randr->status);
-    g_free (randr->position);
-    g_free (randr->output_info);
+    xfce_randr_cleanup (randr);
 
     /* get the x display */
     xdisplay = gdk_x11_display_get_xdisplay (randr->display);



More information about the Xfce4-commits mailing list