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

Eric Blake eblake at redhat.com
Fri Oct 1 20:21:05 UTC 2010


On 10/01/2010 09:31 AM, Daniel Veillard wrote:
>> -    ret = qemudDomainHotplugVcpus(vm, nvcpus);
>> +    switch (flags) {
>> +    case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_PERSISTENT:
>
>   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?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list