qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] checkpatch: add a warning for basename/dirname


From: Julia Suvorova
Subject: [Qemu-devel] [PATCH] checkpatch: add a warning for basename/dirname
Date: Fri, 2 Mar 2018 11:22:45 +0300

Signed-off-by: Julia Suvorova <address@hidden>
---
 scripts/checkpatch.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1b4b812..6c4fb42 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2584,6 +2584,11 @@ sub process {
                        ERROR("__func__ should be used instead of gcc specific 
__FUNCTION__\n"  . $herecurr);
                }
 
+# recommend g_path_get_* over basename(3) and dirname(3)
+               if ($line =~ /\b(basename|dirname)\s*\(/) {
+                       WARN("consider using g_path_get_$1 in preference to 
$1(3)\n" . $herecurr);
+               }
+
 # recommend qemu_strto* over strto* for numeric conversions
                if ($line =~ /\b(strto[^kd].*?)\s*\(/) {
                        ERROR("consider using qemu_$1 in preference to $1\n" . 
$herecurr);
-- 
2.1.4




reply via email to

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