qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 3/4] checkpatch: recommend strtok_r


From: marcandre . lureau
Subject: [Qemu-devel] [PATCH v2 3/4] checkpatch: recommend strtok_r
Date: Fri, 18 Sep 2015 12:59:53 +0200

From: Marc-André Lureau <address@hidden>

If anything, it should recommend strtok_r!

(strtok_r() is reentrant-safe and thread-safe)

Signed-off-by: Paolo Bonzini <address@hidden>
[Better matching and error message - Marc-André]
Signed-off-by: Marc-André Lureau <address@hidden>
---
 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




reply via email to

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