[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] indentation (was: [PATCH 11/12] vcpu: complete vcpu support in qemu driver)

On Fri, Oct 01, 2010 at 02:21:05PM -0600, Eric Blake wrote:
> On 10/01/2010 09:31 AM, Daniel Veillard wrote:
> >>-    ret = qemudDomainHotplugVcpus(vm, nvcpus);
> >>+    switch (flags) {
> >
> >  hum I usually indent the cases 4 spaces from the switch, minor nit
> I just used what emacs gave by default, after applying the suggested
> ~/.emacs settings from HACKING.  In that mode, emacs puts the labels
> flush with the switch.  The libvirt code base has a decent mix of
> both styles, but favors my style over yours (don't ask me how much
> time I wasted trying to figure out that sed script):
> $ git grep -A1 switch src \
>  | sed -n 's/:/-/;/switch/{N;/^\(.*\)switch.*\n\1case/p}' | wc -l
> 350
> $ git grep -A1 switch src \
>  | sed -n 's/:/-/;/switch/{N;/^\(.*\)switch.*\n\1  *case/p}' | wc -l
> 96
> Speaking of indentation nits, are we any closer to Jim's idea of
> using an automated indent-like tool for setting on a consistent
> formatting style?

  Well if the editor/typing habits and the SCM checking rules start to
conflict it can get really messy I'm afraid, but maybe I don't remember
the proposal well.

  What I usuall do when I want to reformat a piece of code is run it
through indent:

indent -bad -bap -bbb -bli4 -br -ce -brs -cs -i4 -l75 -lc75 -nut -sbi4
-psl -saf -sai -saw -sbi4 -ss -sc -cdw -cli4 -npcs -nbc

and in general it does what I'm used to, but I often have to clean the
thing up a bit still.

  Automating it may be a bit painful, what you commit is not what you
have in the patch, I'm a bit vary of that...


Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]