[libvirt] [PATCH v4 13/13] Introduce syntax-check rule to prefer VIR_STRDUP over strdup

Michal Privoznik mprivozn at redhat.com
Fri May 24 08:26:28 UTC 2013


On 23.05.2013 21:34, Eric Blake wrote:
> On 05/20/2013 11:55 AM, Michal Privoznik wrote:
>> ---
>>  cfg.mk | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/cfg.mk b/cfg.mk
>> index bb93c6a..c714915 100644
>> --- a/cfg.mk
>> +++ b/cfg.mk
>> @@ -387,6 +387,11 @@ sc_prohibit_asprintf:
>>  	halt='use strdup instead of virAsprintf with "%s"'		\
> 
> s/strdup/VIR_STRDUP/, so someone following this advice doesn't trigger
> yet another round of syntax failure.
> 
>>  	  $(_sc_search_regexp)
>>  
>> +sc_prohibit_strdup:
>> +	@prohibit='\<strn?dup\> *\('					\
> 
> "\> *(" is redundant; you can omit the \> and still get the same regex
> matching power.
> 
>> +	halt='use VIR_STRDUP, not strdup'				\
>> +	  $(_sc_search_regexp)
>> +
>>  # Prefer virSetUIDGID.
>>  sc_prohibit_setuid:
>>  	@prohibit='\<set(re)?[ug]id\> *\('				\
>> @@ -874,6 +879,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$$)
> 
> ACK with your amendment due to 14/13 and with the above tweaks; but
> obviously don't apply until we've actually fixed the rest of the code :)
> 

I think we did fix the rest of the code - at least I've not hit any
issue with syntax-check.

Thanks for all the fish - I mean review.

Michal




More information about the libvir-list mailing list