[libvirt] [PATCH] Consistent style for usage of sizeof operator

Eric Blake eblake at redhat.com
Thu Mar 29 16:02:00 UTC 2012


On 03/29/2012 09:51 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> The code is splattered with a mix of
> 
>   sizeof foo
>   sizeof (foo)
>   sizeof(foo)
> 
> Standardize on sizeof(foo) and add a syntax check rule to
> enforce it

We might also want to document our policy on 'return 0' and 'sizeof(v)'
in HACKING.

> ---
>  cfg.mk                                       |    4 +

> +++ b/cfg.mk
> @@ -813,3 +813,7 @@ exclude_file_name_regexp--sc_trailing_blank = \.(fig|gif|ico|png)$$
>  
>  exclude_file_name_regexp--sc_unmarked_diagnostics = \
>    ^(docs/apibuild.py|tests/virt-aa-helper-test)$$
> +
> +exclude_file_name_regexp--sc_size_of_brackets = cfg.mk
> +
> +exclude_file_name_regexp--sc_const_long_option = tools/virt-host-validate.c
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c

Where's the new rule that actually adds the syntax check?

The rest of the patch looks mechanical, but we have to get the cfg.mk
part right.  I'm also still looking into the report of why cfg.mk
doesn't seem to be working in relation to the latest per-line exceptions
added to gnulib's syntax-check framework.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120329/e6d041e9/attachment-0001.sig>


More information about the libvir-list mailing list