[mutter] Avoid shadowing existing variables
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] Avoid shadowing existing variables
- Date: Thu, 24 Sep 2015 01:10:38 +0000 (UTC)
commit bc00f118f3e0c3ae82c04a0c70a9118c9be5fa9f
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Sep 24 01:24:33 2015 +0200
Avoid shadowing existing variables
src/backends/meta-input-settings.c | 4 +--
src/backends/meta-monitor-config.c | 2 +-
src/backends/meta-monitor-manager-dummy.c | 7 ++--
src/backends/native/meta-launcher.c | 6 ++--
src/backends/x11/meta-backend-x11.c | 39 ++++++++++-------------
src/backends/x11/meta-monitor-manager-xrandr.c | 15 ++++-----
src/core/display.c | 5 +--
src/core/events.c | 4 +-
src/core/stack.c | 6 +---
src/core/window.c | 8 ++--
src/tests/test-runner.c | 1 -
src/wayland/meta-xwayland-selection.c | 1 -
12 files changed, 41 insertions(+), 57 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 05870a1..2f8ed77 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -523,15 +523,13 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
}
else if (!device)
{
- MetaInputSettingsPrivate *priv;
const GSList *devices;
- priv = meta_input_settings_get_instance_private (input_settings);
devices = clutter_device_manager_peek_devices (priv->device_manager);
while (devices)
{
- ClutterInputDevice *device = devices->data;
+ device = devices->data;
if (device_is_trackball (device))
input_settings_class->set_scroll_button (input_settings, device, button);
diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c
index ba0ae57..e6e3791 100644
--- a/src/backends/meta-monitor-config.c
+++ b/src/backends/meta-monitor-config.c
@@ -1846,7 +1846,7 @@ crtc_assignment_assign (CrtcAssignment *assign,
}
else
{
- MetaCRTCInfo *info = g_slice_new0 (MetaCRTCInfo);
+ info = g_slice_new0 (MetaCRTCInfo);
info->crtc = crtc;
info->mode = mode;
diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c
index 51e8cbf..0b59119 100644
--- a/src/backends/meta-monitor-manager-dummy.c
+++ b/src/backends/meta-monitor-manager-dummy.c
@@ -197,7 +197,7 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
{
MetaMonitorMode *mode;
MetaOutput *output;
- int i, n_outputs;
+ unsigned int j;
int width, height;
mode = crtc_info->mode;
@@ -223,10 +223,9 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
screen_width = MAX (screen_width, crtc_info->x + width);
screen_height = MAX (screen_height, crtc_info->y + height);
- n_outputs = crtc_info->outputs->len;
- for (i = 0; i < n_outputs; i++)
+ for (j = 0; j < crtc_info->outputs->len; j++)
{
- output = ((MetaOutput**)crtc_info->outputs->pdata)[i];
+ output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
output->is_dirty = TRUE;
output->crtc = crtc;
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
index 618bd68..d7da9e8 100644
--- a/src/backends/native/meta-launcher.c
+++ b/src/backends/native/meta-launcher.c
@@ -112,12 +112,12 @@ get_seat_proxy (GCancellable *cancellable)
static void
session_unpause (void)
{
- ClutterBackend *backend;
+ ClutterBackend *clutter_backend;
CoglContext *cogl_context;
CoglDisplay *cogl_display;
- backend = clutter_get_default_backend ();
- cogl_context = clutter_backend_get_cogl_context (backend);
+ clutter_backend = clutter_get_default_backend ();
+ cogl_context = clutter_backend_get_cogl_context (clutter_backend);
cogl_display = cogl_context_get_display (cogl_context);
cogl_kms_display_queue_modes_reset (cogl_display);
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index e86589c..7ad28fd 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -441,6 +441,7 @@ meta_backend_x11_post_init (MetaBackend *backend)
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
int major, minor;
+ gboolean has_xi = FALSE;
priv->xdisplay = clutter_x11_get_default_display ();
@@ -450,27 +451,23 @@ meta_backend_x11_post_init (MetaBackend *backend)
!XSyncInitialize (priv->xdisplay, &major, &minor))
meta_fatal ("Could not initialize XSync");
- {
- int major = 2, minor = 3;
- gboolean has_xi = FALSE;
-
- if (XQueryExtension (priv->xdisplay,
- "XInputExtension",
- &priv->xinput_opcode,
- &priv->xinput_error_base,
- &priv->xinput_event_base))
- {
- if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success)
- {
- int version = (major * 10) + minor;
- if (version >= 22)
- has_xi = TRUE;
- }
- }
+ if (XQueryExtension (priv->xdisplay,
+ "XInputExtension",
+ &priv->xinput_opcode,
+ &priv->xinput_error_base,
+ &priv->xinput_event_base))
+ {
+ major = 2; minor = 3;
+ if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success)
+ {
+ int version = (major * 10) + minor;
+ if (version >= 22)
+ has_xi = TRUE;
+ }
+ }
- if (!has_xi)
- meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
- }
+ if (!has_xi)
+ meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
/* We only take the passive touch grab if we are a X11 compositor */
if (priv->mode == META_BACKEND_X11_MODE_COMPOSITOR)
@@ -795,8 +792,6 @@ meta_backend_x11_update_screen_size (MetaBackend *backend,
}
else
{
- MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
- MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
Window xwin = meta_backend_x11_get_xwindow (x11);
XResizeWindow (priv->xdisplay, xwin, width, height);
}
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index dd10c38..9008841 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -1133,17 +1133,16 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
if (crtc_info->mode != NULL)
{
MetaMonitorMode *mode;
- g_autofree XID *outputs = NULL;
- unsigned int j, n_outputs;
- int width, height;
+ g_autofree XID *output_ids = NULL;
+ unsigned int j, n_output_ids;
Status ok;
mode = crtc_info->mode;
- n_outputs = crtc_info->outputs->len;
- outputs = g_new (XID, n_outputs);
+ n_output_ids = crtc_info->outputs->len;
+ output_ids = g_new (XID, n_output_ids);
- for (j = 0; j < n_outputs; j++)
+ for (j = 0; j < n_output_ids; j++)
{
MetaOutput *output;
@@ -1152,7 +1151,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
output->is_dirty = TRUE;
output->crtc = crtc;
- outputs[j] = output->winsys_id;
+ output_ids[j] = output->winsys_id;
}
ok = XRRSetCrtcConfig (manager_xrandr->xdisplay,
@@ -1162,7 +1161,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
crtc_info->x, crtc_info->y,
(XID)mode->mode_id,
meta_monitor_transform_to_xrandr (crtc_info->transform),
- outputs, n_outputs);
+ output_ids, n_output_ids);
if (ok != Success)
{
diff --git a/src/core/display.c b/src/core/display.c
index e7afd63..a7bf0cd 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -607,12 +607,11 @@ meta_display_open (void)
meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
XInternAtoms (display->xdisplay, (char **)atom_names, G_N_ELEMENTS (atom_names),
False, atoms);
- {
- int i = 0;
+
+ i = 0;
#define item(x) display->atom_##x = atoms[i++];
#include <x11/atomnames.h>
#undef item
- }
display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display);
diff --git a/src/core/events.c b/src/core/events.c
index 4c6d334..25e0719 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -206,8 +206,8 @@ meta_display_handle_event (MetaDisplay *display,
if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION)
{
- MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (NULL);
- meta_cursor_tracker_update_position (tracker, event->motion.x, event->motion.y);
+ meta_cursor_tracker_update_position (meta_cursor_tracker_get_for_screen (NULL),
+ event->motion.x, event->motion.y);
display->monitor_cache_invalidated = TRUE;
}
diff --git a/src/core/stack.c b/src/core/stack.c
index 87dade1..90655ab 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -1088,11 +1088,7 @@ stack_sync_to_xserver (MetaStack *stack)
if (w->hidden)
{
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
- {
- guint64 stack_id = top_level_window;
-
- g_array_append_val (x11_hidden_stack_ids, stack_id);
- }
+ g_array_append_val (x11_hidden_stack_ids, top_level_window);
continue;
}
diff --git a/src/core/window.c b/src/core/window.c
index eeeb2e0..19d5c48 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4312,8 +4312,8 @@ set_workspace_state (MetaWindow *window,
GList *l;
for (l = window->screen->workspaces; l != NULL; l = l->next)
{
- MetaWorkspace *workspace = l->data;
- meta_workspace_remove_window (workspace, window);
+ MetaWorkspace *ws = l->data;
+ meta_workspace_remove_window (ws, window);
}
}
@@ -4327,8 +4327,8 @@ set_workspace_state (MetaWindow *window,
GList *l;
for (l = window->screen->workspaces; l != NULL; l = l->next)
{
- MetaWorkspace *workspace = l->data;
- meta_workspace_add_window (workspace, window);
+ MetaWorkspace *ws = l->data;
+ meta_workspace_add_window (ws, window);
}
}
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index c395d92..842944d 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -1094,7 +1094,6 @@ main (int argc, char **argv)
if (all_tests)
{
GFile *test_dir = g_file_new_for_path (MUTTER_PKGDATADIR "/tests");
- GError *error = NULL;
if (!find_metatests_in_directory (test_dir, tests, &error))
{
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index 105ea5c..1728a58 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -160,7 +160,6 @@ xdnd_send_enter (MetaXWaylandSelection *selection_data,
if (source_mime_types->size <= 3)
{
/* The mimetype atoms fit in this same message */
- gchar **p;
gint i = 2;
wl_array_for_each (p, source_mime_types)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]