[Libvir] RFC: Add a short doc with libvirt coding style guidelines

Mark McLoughlin markmc at redhat.com
Mon Jan 14 14:35:10 UTC 2008


On Mon, 2008-01-14 at 14:11 +0000, Daniel P. Berrange wrote:
> On Mon, Jan 14, 2008 at 08:40:35AM +0000, Mark McLoughlin wrote:
> > Hey,
> > 	There's a few more obvious things missing, I think - e.g. should new
> > code use lower_case_with_underscores naming style or mixedCase ?
> 
> Really ? About 70% of our code currently uses mixed case, no underscores.
> The QEMU/network driver file & mdns file are the main ones which don't.

	But does the 70/30 split imply that it's okay for people writing new
code for libvirt to use lower_case_with_underscores or not? I'm guessing
not, especially since all your storage stuff is mixedCase, but it'd be
worth pointing out in HACKING.

	My main point was that some details on what is considered to be the
libvirt coding style (aside form indentation) might help people.

> > On Sun, 2008-01-13 at 17:39 +0000, Daniel P. Berrange wrote:
> > >   2. Do not use conditionals in front of 'free'.
> > > 
> > >      eg Instead of
> > > 
> > >        if (foo) free(foo)
> > > 
> > >      Use
> > > 
> > >        free(foo)
> > 
> > 	That's only safe with glibc, right ?
> 
> The man page says its C89 standard and the nice folks at Wine have done
> some background checks which show its safe on any modern UNIX...
> 
> http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html 

	Cool stuff, new to me.

Cheers,
Mark.




More information about the libvir-list mailing list