From: Marc-André Lureau <marcandre.lur...@redhat.com> If anything, it should recommend strtok_r!
(strtok_r() is reentrant-safe and thread-safe) Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> [Better matching and error message - Marc-André] Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- scripts/checkpatch.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 574334b..20406d4 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2463,9 +2463,13 @@ sub process { WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); } +# recommend strtok_r over strtok + if ($line =~ /strtok_r\(/) { + } elsif ($line =~ /strtok\(/) { + WARN("consider using strtok_r in preference to $1\n" . $herecurr); # recommend qemu_strto* over strto* - if ($line =~ /\b(strto.*?)\s*\(/) { - WARN("consider using qemu_$1 in preference to $1\n" . $herecurr); + } elsif ($line =~ /\b(strto.*?)\s*\(/) { + WARN("consider using qemu_$1 in preference to $1\n" . $herecurr); } # check for module_init(), use category-specific init macros explicitly please if ($line =~ /^module_init\s*\(/) { -- 2.4.3