qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] checkpatch: add a warning for basename/dirname


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] checkpatch: add a warning for basename/dirname
Date: Fri, 2 Mar 2018 09:56:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 02/03/2018 09:22, Julia Suvorova wrote:
> Signed-off-by: Julia Suvorova <address@hidden>
> ---
>  scripts/checkpatch.pl | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 1b4b812..6c4fb42 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2584,6 +2584,11 @@ sub process {
>                       ERROR("__func__ should be used instead of gcc specific 
> __FUNCTION__\n"  . $herecurr);
>               }
>  
> +# recommend g_path_get_* over basename(3) and dirname(3)
> +             if ($line =~ /\b(basename|dirname)\s*\(/) {
> +                     WARN("consider using g_path_get_$1 in preference to 
> $1(3)\n" . $herecurr);
> +             }
> +
>  # recommend qemu_strto* over strto* for numeric conversions
>               if ($line =~ /\b(strto[^kd].*?)\s*\(/) {
>                       ERROR("consider using qemu_$1 in preference to $1\n" . 
> $herecurr);
> 

Hi Julia, the patch is fine, but given Alex's objections let's warn only
if you are doing g_strdup(basename(...)) or g_strdup(dirname(...)).

(No other action is needed on your other patch).

Thanks!

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]