diff --git a/man/writing-rules.docbook b/man/writing-rules.docbook
index deb2ba782..3abb2ec12 100644
--- a/man/writing-rules.docbook
+++ b/man/writing-rules.docbook
@@ -140,24 +140,19 @@
free(p);
}
- To see the simplified code use cppcheck --debug
- dealloc.cpp.
+ To see the simplified code you can use cppcheck
+ --rule=".+" dealloc.cpp:
- ##file dealloc.cpp
-1: void f ( ) {
-2: if ( p ) {
-3: free ( p ) ; }
-4: }
+ $ ./cppcheck --rule=".+" dealloc.cpp
+Checking dealloc.cpp...
+[dealloc.cpp:1]: (style) found ' void f ( ) { if ( p ) { free ( p ) ; } }'
- In the --debug output there are line feeds and
- line numbers. But the newlines and line numbers are only there to make
- the output easier to read. The real simplified code is written on a
- single line:
+ In short, the simplified code is:
- void f ( ) { if ( p ) { free ( p ) ; } }
+ void f ( ) { if ( p ) { free ( p ) ; } }
- Now we can use cppcheck --rule to develop a
- regular expression.
+ Now that the simplified code is known we can create a regular
+ expression:
$ cppcheck --rule="if \( p \) { free \( p \) ; }" dealloc.cpp
Checking dealloc.cpp...