aboutsummaryrefslogtreecommitdiffstats
path: root/tools/patcheck
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-02-08 13:30:34 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-02-08 13:30:34 +0000
commit3d8f9025b10b9782341592498618f14aa1ccd433 (patch)
tree1a1c462b7bf9b5fa36e17860097cad295648f48e /tools/patcheck
parent6c2dd77eb273645e502f83a8537b091877d3a21d (diff)
downloadffmpeg-3d8f9025b10b9782341592498618f14aa1ccd433.tar.gz
Factorize grep -v cases.
Originally committed as revision 17056 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'tools/patcheck')
-rwxr-xr-xtools/patcheck19
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/patcheck b/tools/patcheck
index 7f99afca8f..1ee6e1557b 100755
--- a/tools/patcheck
+++ b/tools/patcheck
@@ -23,6 +23,15 @@ hiegrep(){
cat $TMP
}
+hiegrep2(){
+ arg="$1"
+ varg="$2"
+ msg="$3"
+ shift 3
+ grep $OPT '^+' $* | grep -v ':+++' | egrep -v -- "$varg" | egrep --color=always -- "$arg" > $TMP && echo -e "\n$msg"
+ cat $TMP
+}
+
hiegrep '[[:space:]]$' 'trailing whitespace' $*
hiegrep "`echo x | tr 'x' '\t'`" 'tabs' $*
#hiegrep ':\+$' 'Empty lines' $*
@@ -32,8 +41,7 @@ hiegrep '//[-/<\* ]*$' 'empty comment' $*
hiegrep '/\*[-<\* ]*\*/' 'empty comment' $*
hiegrep 'for *\( *'"$ERE_PRITYP"' ' 'not gcc 2.95 compatible' $*
-egrep $OPT '^\+(int|unsigned|static|void)[a-zA-Z0-9 _]*(init|end)[a-zA-Z0-9 _]*\(.*[^;]$' $* | grep -v 'av_cold'> $TMP && echo -e '\nThese functions may need av_cold, please review the whole patch for similar functions needing av_cold'
-cat $TMP
+hiegrep2 '(int|unsigned|static|void)[a-zA-Z0-9 _]*(init|end)[a-zA-Z0-9 _]*\(.*[^;]$' '(av_cold|:\+[^a-zA-Z_])' 'These functions may need av_cold, please review the whole patch for similar functions needing av_cold' $*
hiegrep '\+= *1 *;' 'can be simplified to ++' $*
hiegrep '-= *1 *;' 'can be simplified to --' $*
@@ -58,15 +66,12 @@ hiegrep 'if *\( *(0|1) *\)' 'useless if()' $*
hiegrep '& *[a-zA-Z0-9_]* *\[ *0 *\]' 'useless & [0]' $*
hiegrep '(\( *[0-9] *(&&|\|\|)|(&&|\|\|) *[0-9] *\))' 'overriding condition' $*
-
-egrep $OPT '^\+.*\.long_name *=' $*| grep -v 'NULL_IF_CONFIG_SMAL'> $TMP && echo -e '\nmissing NULL_IF_CONFIG_SMAL'
-cat $TMP
+hiegrep2 '\.long_name *=' 'NULL_IF_CONFIG_SMAL' 'missing NULL_IF_CONFIG_SMAL' $*
#egrep $OPT '^\+.*const ' $*| grep -v 'static'> $TMP && echo -e '\nnon static const'
#cat $TMP
-egrep $OPT '^\+'"$ERE_TYPES" $*| grep ':+[a-zA-Z]' | egrep -v '(static|av_|ff_|typedef)'> $TMP && echo -e '\nNon static with no ff_/av_ prefix'
-cat $TMP
+hiegrep2 "$ERE_TYPES" '(static|av_|ff_|typedef|:\+[^a-zA-Z_])' 'Non static with no ff_/av_ prefix' $*
hiegrep ':\+[^}]*else' 'missing } prior to else' $*