[libvirt] [PATCH v2 35/37] Introduce syntax-check rule to prefer VIR_STRDUP over strdup

John Ferlan jferlan at redhat.com
Tue Apr 30 13:03:10 UTC 2013


On 04/29/2013 09:50 AM, Michal Privoznik wrote:
> ---
>  cfg.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/cfg.mk b/cfg.mk
> index d499ded..4c6d85c 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -383,6 +383,11 @@ sc_prohibit_asprintf:
>  	halt='use virAsprintf, not as'printf				\
>  	  $(_sc_search_regexp)
>  
> +sc_prohibit_strdup:
> +	@prohibit='\<strn?dup\> *\('					\
> +	halt='use VIR_STRUP, not strdup'				\

s/STRUP/STRDUP/

Do there need to be separate rules for STRDUP and STRNDUP?


> +	  $(_sc_search_regexp)
> +
>  # Prefer virSetUIDGID.
>  sc_prohibit_setuid:
>  	@prohibit='\<set(re)?[ug]id\> *\('				\
> @@ -860,6 +865,9 @@ exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
>  exclude_file_name_regexp--sc_prohibit_asprintf = \
>    ^(bootstrap.conf$$|src/util/virstring\.c$$|examples/domain-events/events-c/event-test\.c$$|tests/vircgroupmock\.c$$)
>  
> +exclude_file_name_regexp--sc_prohibit_strdup = \
> +  ^(docs/|examples/|python/|src/util/virstring\.c$$|tools/virsh\.c$$)
> +
>  exclude_file_name_regexp--sc_prohibit_close = \
>    (\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c|tests/vircgroupmock\.c)$$)
>  
> 




More information about the libvir-list mailing list