[gnome-desktop] Don’t shadow variables



commit 5d5fa677a98129b8558ad9c048844a89851c7bad
Author: Ernestas Kulik <ernestask gnome org>
Date:   Mon Feb 12 18:34:39 2018 +0200

    Don’t shadow variables
    
    Especially if the types don’t match.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=793195

 libgnome-desktop/gnome-bg-slide-show.c |    8 ++++----
 libgnome-desktop/gnome-rr-config.c     |    2 +-
 libgnome-desktop/gnome-rr.c            |   15 +++------------
 3 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg-slide-show.c b/libgnome-desktop/gnome-bg-slide-show.c
index 4e4f707..fe56f9d 100644
--- a/libgnome-desktop/gnome-bg-slide-show.c
+++ b/libgnome-desktop/gnome-bg-slide-show.c
@@ -673,23 +673,23 @@ parse_file_contents (GnomeBGSlideShow  *self,
         g_markup_parse_context_free (context);
 
         if (!failed) {
-                guint len;
+                guint queue_length;
 
                 t = mktime (&self->priv->start_tm);
 
                 self->priv->start_time = (double)t;
 
-                len = g_queue_get_length (self->priv->slides);
+                queue_length = g_queue_get_length (self->priv->slides);
 
                 /* no slides, that's not a slideshow */
-                if (len == 0) {
+                if (queue_length == 0) {
                         g_set_error_literal (error,
                                              G_MARKUP_ERROR,
                                              G_MARKUP_ERROR_INVALID_CONTENT,
                                              "file is not a slide show since it has no slides");
                         failed = TRUE;
                 /* one slide, there's no transition */
-                } else if (len == 1) {
+                } else if (queue_length == 1) {
                         Slide *slide = self->priv->slides->head->data;
                         slide->duration = self->priv->total_duration = G_MAXUINT;
                 }
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index c3c9d42..7675e5a 100644
--- a/libgnome-desktop/gnome-rr-config.c
+++ b/libgnome-desktop/gnome-rr-config.c
@@ -818,7 +818,7 @@ crtc_assignment_assign (CrtcAssignment   *assign,
     }
     else
     {  
-       CrtcInfo *info = g_new0 (CrtcInfo, 1);
+       info = g_new0 (CrtcInfo, 1);
        
        info->mode = mode;
        info->x = x;
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 0b7c506..353af0e 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -454,13 +454,10 @@ fill_screen_info_from_resources (ScreenInfo *info,
     a = g_ptr_array_new ();
     for (i = 0; i < ncrtc; ++i)
     {
-       GnomeRRCrtc *crtc;
-
        g_variant_get_child (crtcs, i, META_CRTC_STRUCT, &id,
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-       crtc = crtc_new (info, id);
 
-       g_ptr_array_add (a, crtc);
+       g_ptr_array_add (a, crtc_new (info, id));
     }
     g_ptr_array_add (a, NULL);
     info->crtcs = (GnomeRRCrtc **)g_ptr_array_free (a, FALSE);
@@ -468,13 +465,10 @@ fill_screen_info_from_resources (ScreenInfo *info,
     a = g_ptr_array_new ();
     for (i = 0; i < noutput; ++i)
     {
-       GnomeRROutput *output;
- 
        g_variant_get_child (outputs, i, META_OUTPUT_STRUCT, &id,
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-       output = output_new (info, id);
 
-       g_ptr_array_add (a, output);
+       g_ptr_array_add (a, output_new (info, id));
     }
     g_ptr_array_add (a, NULL);
     info->outputs = (GnomeRROutput **)g_ptr_array_free (a, FALSE);
@@ -482,13 +476,10 @@ fill_screen_info_from_resources (ScreenInfo *info,
     a = g_ptr_array_new ();
     for (i = 0;  i < nmode; ++i)
     {
-       GnomeRRMode *mode;
-
        g_variant_get_child (modes, i, META_MONITOR_MODE_STRUCT, &id,
                             NULL, NULL, NULL, NULL, NULL);
-       mode = mode_new (info, id);
 
-       g_ptr_array_add (a, mode);
+       g_ptr_array_add (a, mode_new (info, id));
     }
     g_ptr_array_add (a, NULL);
     info->modes = (GnomeRRMode **)g_ptr_array_free (a, FALSE);


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