[Spice-devel] [PATCH spice-gtk 2/5] widget: minor code style improvements
Marc-André Lureau
marcandre.lureau at redhat.com
Thu Jun 8 08:31:20 UTC 2017
Hi
----- Original Message -----
> On Thu, Jun 08, 2017 at 12:55:38AM +0400, marcandre.lureau at redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau at redhat.com>
> >
> > Use shorter line, use the common "d" variable for private data access,
> > add brackets to ease reading the inner block vs the condition, remove
> > needless != NULL.
>
> I'd lean towards NACK for this one, one letter variable names is imo
> very bad for readability. I know this is widespread in the spice-gtk
> codebase, but I'd at least rather not expand that usage.
>
You may rename it "priv", but then you lost the benefit of being really short.
Imho private members access are fine with a one letter pointer variable, if consistently used that way.
> Christophe
>
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> > ---
> > src/spice-widget.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > index 1a1d5a6..d948c6d 100644
> > --- a/src/spice-widget.c
> > +++ b/src/spice-widget.c
> > @@ -617,10 +617,12 @@ drawing_area_realize(GtkWidget *area, gpointer
> > user_data)
> > {
> > #ifdef GDK_WINDOWING_X11
> > SpiceDisplay *display = SPICE_DISPLAY(user_data);
> > + SpiceDisplayPrivate *d = display->priv;
> >
> > if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
> > -
> > spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(display->priv->display))
> > != NULL)
> > + spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display))) {
> > spice_display_widget_gl_scanout(display);
> > + }
> >
> > #endif
> > }
> > --
> > 2.13.0.91.g00982b8dd
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list