krb5 commit: Fix cast regexp in C style checker
Greg Hudson
ghudson at MIT.EDU
Thu Oct 11 13:24:41 EDT 2012
https://github.com/krb5/krb5/commit/dd25220d170f128f782758337f8e6b951adaee5f
commit dd25220d170f128f782758337f8e6b951adaee5f
Author: Greg Hudson <ghudson at mit.edu>
Date: Thu Oct 11 13:22:29 2012 -0400
Fix cast regexp in C style checker
In check_cast, we want to match cast operators with or without spaces
after the closing paren, and then check for spaces after we match.
Also, per the comment, we want to match potential cast operators
followed by an open paren.
src/util/cstyle-file.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util/cstyle-file.py b/src/util/cstyle-file.py
index edf8a39..2295104 100644
--- a/src/util/cstyle-file.py
+++ b/src/util/cstyle-file.py
@@ -141,7 +141,7 @@ def check_cast(line, ln):
# multiplication operator. We will get false positives from
# "(*fp) (args)" and "if (condition) statement", but both of those
# are erroneous anyway.
- for m in re.finditer(r'\(([^(]+)\)(\s+)[a-zA-Z_]', line):
+ for m in re.finditer(r'\(([^(]+)\)(\s*)[a-zA-Z_(]', line):
if m.group(2):
warn(ln, 'Space after cast operator (or inline if/while body)')
# Check for casts like (char*) which should have a space.
More information about the cvs-krb5
mailing list