From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH v2 3/4] checkpatch: recommend strtok_r
Date: Fri, 18 Sep 2015 12:59:53 +0200 [thread overview]
Message-ID: <1442573994-14632-3-git-send-email-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <1442573994-14632-1-git-send-email-marcandre.lureau@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
If anything, it should recommend strtok_r!
(strtok_r() is reentrant-safe and thread-safe)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Better matching and error message - Marc-André]
Signed-off-by: Marc-André Lureau <marcandre.lureau@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
next prev parent reply other threads:[~2015-09-18 11:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 10:59 [Qemu-devel] [PATCH v2 1/4] utils: rename strtosz to use qemu prefix marcandre.lureau
2015-09-18 10:59 ` [Qemu-devel] [PATCH v2 2/4] tests: add some qemu_strtosz() tests marcandre.lureau
2015-09-18 15:05 ` Eric Blake
2015-09-18 15:10 ` Marc-André Lureau
2015-09-18 15:21 ` Eric Blake
2015-09-18 10:59 ` marcandre.lureau [this message]
2015-09-18 10:59 ` [Qemu-devel] [PATCH v2 4/4] Replace strotok() by strtok_r() marcandre.lureau
2015-09-18 15:22 ` Paolo Bonzini
2015-09-18 15:44 ` Marc-André Lureau
2015-09-18 15:03 ` [Qemu-devel] [PATCH v2 1/4] utils: rename strtosz to use qemu prefix Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442573994-14632-3-git-send-email-marcandre.lureau@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).