lkml.org 
[lkml]   [2011]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 02/11] checkpatch: check for common memset parameter issues against statments
From
Date
On Mon, 2011-11-28 at 15:42 +0000, Andy Whitcroft wrote:
> Move the memset checks over to work against the statement. Also add
> checks for 0 and 1 used as lengths. Generally these indicate badly
> ordered parameters.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3111,6 +3111,28 @@ sub process {
> "Avoid line continuations in quoted strings\n" . $herecurr);
> }
>
> +# Check for misused memsets
> + if (defined $stat && $stat =~ /\bmemset\s*\((.*)\)/s) {

Perhaps this is better.
It allows close parenthesis in the memset.
eg: memset(foo, bar(baz), sizeof(foo));

if (defined $stat && $stat = /\bmemset\s*$match_balanced_parentheses/s) {



\
 
 \ /
  Last update: 2011-11-29 01:35    [from the cache]
©2003-2011 Jasper Spaans