From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZctOg-00017i-JN for qemu-devel@nongnu.org; Fri, 18 Sep 2015 07:00:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZctOf-0004z9-HA for qemu-devel@nongnu.org; Fri, 18 Sep 2015 07:00:06 -0400 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:34021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZctOf-0004yp-E4 for qemu-devel@nongnu.org; Fri, 18 Sep 2015 07:00:05 -0400 Received: by qkfq186 with SMTP id q186so17716150qkf.1 for ; Fri, 18 Sep 2015 04:00:05 -0700 (PDT) Sender: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= From: marcandre.lureau@redhat.com Date: Fri, 18 Sep 2015 12:59:53 +0200 Message-Id: <1442573994-14632-3-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1442573994-14632-1-git-send-email-marcandre.lureau@redhat.com> References: <1442573994-14632-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v2 3/4] checkpatch: recommend strtok_r List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-André Lureau If anything, it should recommend strtok_r! (strtok_r() is reentrant-safe and thread-safe) Signed-off-by: Paolo Bonzini [Better matching and error message - Marc-André] Signed-off-by: Marc-André Lureau --- 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