[virt-tools-list] [PATCH v4 2/5] Minor code cleanups

Jonathon Jongsma jjongsma at redhat.com
Mon Feb 15 20:05:11 UTC 2016


On Mon, 2016-02-15 at 12:31 -0200, Eduardo Lima (Etrunko) wrote:
> - Reuse #ifdef HAVE_SPICE_GTK block for include.
> - Move declaration of vfunc together with others of the same class.
> - Move variable declaration to the top of the function.
> 
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
> ---
>  src/remote-viewer.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> index 8e4754f..e712d61 100644
> --- a/src/remote-viewer.c
> +++ b/src/remote-viewer.c
> @@ -36,11 +36,9 @@
>  
>  #ifdef HAVE_SPICE_GTK
>  #include <spice-controller.h>
> -#endif
> -
> -#ifdef HAVE_SPICE_GTK
>  #include "virt-viewer-session-spice.h"
>  #endif
> +
>  #include "virt-viewer-app.h"
>  #include "virt-viewer-auth.h"
>  #include "virt-viewer-file.h"
> @@ -195,10 +193,10 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>  
>      object_class->get_property = remote_viewer_get_property;
>      object_class->set_property = remote_viewer_set_property;
> +    object_class->dispose = remote_viewer_dispose;
>  
>      app_class->start = remote_viewer_start;
>      app_class->deactivated = remote_viewer_deactivated;
> -    object_class->dispose = remote_viewer_dispose;
>  #ifdef HAVE_SPICE_GTK
>      app_class->activate = remote_viewer_activate;
>      app_class->window_added = remote_viewer_window_added;
> @@ -617,10 +615,13 @@ spice_ctrl_listen_async_cb(GObject *object,
>  static gboolean
>  remote_viewer_activate(VirtViewerApp *app, GError **error)
>  {
> -    g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
> -    RemoteViewer *self = REMOTE_VIEWER(app);
> +    RemoteViewer *self;
>      gboolean ret = FALSE;
>  
> +    g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
> +
> +    self = REMOTE_VIEWER(app);
> +
>      if (self->priv->controller) {
>          SpiceSession *session = remote_viewer_get_spice_session(self);
>          ret = spice_session_connect(session);



OK, they're not really related, but they're small enough that I don't think it
makes much sense to split them.

Acked-by: Jonathon Jongsma <jjongsma at redhat.com>




More information about the virt-tools-list mailing list