[Spice-devel] [PATCH spice-gtk v2 4/4] gtk-session: move variables to internal scope
Frediano Ziglio
fziglio at redhat.com
Thu May 18 17:37:53 UTC 2017
>
> From: Victor Toso <me at victortoso.com>
>
> Signed-off-by: Victor Toso <victortoso at redhat.com>
> ---
> src/spice-gtk-session.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index 3cd810a..7678305 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -618,8 +618,7 @@ static void clipboard_get_targets(GtkClipboard
> *clipboard,
>
> SpiceGtkSessionPrivate *s = self->priv;
> guint32 types[SPICE_N_ELEMENTS(atom2agent)] = { 0 };
> - char *name;
> - int a, m, t;
> + int a;
> int selection;
> gint num_types;
>
> @@ -637,11 +636,14 @@ static void clipboard_get_targets(GtkClipboard
> *clipboard,
> /* Set all Atoms that matches our current protocol implementation */
> num_types = 0;
> for (a = 0; a < n_atoms; a++) {
> - name = gdk_atom_name(atoms[a]);
> + guint m;
> + gchar *name = gdk_atom_name(atoms[a]);
>
> SPICE_DEBUG(" \"%s\"", name);
>
> for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) {
> + guint t;
> +
> if (strcasecmp(name, atom2agent[m].xatom) != 0) {
> continue;
> }
Acked.
Even shorter would be to put the indexes declaration inside the for-s.
Frediano
More information about the Spice-devel
mailing list