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

Nick Schermer noreply at xfce.org
Sat Aug 28 23:04:26 CEST 2010


Updating branch refs/heads/master
         to d2cedfa030128a51d5e289d71bd9ef378c4e4e33 (commit)
       from 16dea75cc8b0be390579a22bed1831aae1f45885 (commit)

commit d2cedfa030128a51d5e289d71bd9ef378c4e4e33
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