Added rule files based on rules suggested by jglathe

This commit is contained in:
Daniel Marjamäki 2012-07-10 21:18:59 +02:00
parent 17cf24ed34
commit 57ebed20c4
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<rule version="1">
<pattern> if \( ([!] )*?(strlen) \( \w+? \) ([>] [0] )*?\) { </pattern>
<message>
<id>StrlenEmptyString</id>
<severity>performance</severity>
<summary>Using strlen() to check if a string is empty is not efficient.</summary>
</message>
</rule>

9
rules/unused-deref.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<rule version="1">
<pattern> [;{}] [*] \w+? (\+\+|\-\-) ; </pattern>
<message>
<id>UnusedDeref</id>
<severity>style</severity>
<summary>Redundant * found, "*p++" is the same as "*(p++)".</summary>
</message>
</rule>