[virt-tools-list] [PATCH virt-viewer v2 3/3] Write vm name to config file as comment

Jonathon Jongsma jjongsma at redhat.com
Mon Aug 4 17:02:51 UTC 2014


----- Original Message ----- 

> From: "Fabiano Fidêncio" <fabiano at fidencio.org>
> To: "Jonathon Jongsma" <jjongsma at redhat.com>
> Cc: virt-tools-list at redhat.com
> Sent: Tuesday, July 22, 2014 9:06:59 AM
> Subject: Re: [virt-tools-list] [PATCH virt-viewer v2 3/3] Write vm name to
> config file as comment

> On Mon, Jun 30, 2014 at 10:49 PM, Jonathon Jongsma < jjongsma at redhat.com >
> wrote:

> > ---
> > src/virt-viewer-app.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> 
> > diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> > index 6bd49f4..158a638 100644
> > --- a/src/virt-viewer-app.c
> > +++ b/src/virt-viewer-app.c
> > @@ -242,6 +242,20 @@ virt_viewer_app_save_config(VirtViewerApp *self)
> > g_warning("failed to create config directory");
> > g_free(dir);
> 
> > + if (priv->uuid && priv->guest_name) {
> > + // if there's no comment for this uuid settings group, add a comment
> > + // with the vm name so user can make sense of it later.
> > + gchar* comment = g_key_file_get_comment(priv->config, priv->uuid, NULL,
> > &error);
> 
> Coding style here, use: gchar *comment (...)


I've been meaning to bring this up for some time actually. Currently, the spice coding style definitions ( http://www.spice-space.org/docs/spice_style.pdf ) state that '*' should be attached to the type name, not the variable name (section 24.5). On the other hand, much of the code does not follow this guideline. It seems that in virt-viewer, the "wrong" way (according to the coding style document) is more common than the "right" way.  This is not a perfect measurement, but it's a decent approximation:

$ git grep "\w\* " -- src/ |wc -l
238
$ git grep " \*\w" -- src/ |wc -l
1777

So, should we just adopt the majority format and use "Type *varname" for all new code?

Jonathon




More information about the virt-tools-list mailing list