summaryrefslogtreecommitdiff
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2017-06-05 15:54:21 +0000
committerNick Mathewson <nickm@torproject.org>2017-08-24 15:22:20 -0400
commit9e1fa959201611b764ac90ce59485d33b8ea975b (patch)
tree8e11b1b0286995116eec2e52d713ed0cd4777c9d /scripts/coccinelle
parent7666cd88817422da17f6ef725122ce0b230c1d24 (diff)
downloadtor-9e1fa959201611b764ac90ce59485d33b8ea975b.tar.gz
tor-9e1fa959201611b764ac90ce59485d33b8ea975b.zip
Add Coccinelle patch for replacing NULL/non-NULL tt_assert().
This patch replaces tt_assert() checks for NULL/non-NULL values with tt_ptr_op().
Diffstat (limited to 'scripts/coccinelle')
-rw-r--r--scripts/coccinelle/test_assert_null.cocci11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/coccinelle/test_assert_null.cocci b/scripts/coccinelle/test_assert_null.cocci
new file mode 100644
index 0000000000..3d66e1ee0b
--- /dev/null
+++ b/scripts/coccinelle/test_assert_null.cocci
@@ -0,0 +1,11 @@
+@@
+expression * e;
+@@
+
+(
+- tt_assert(e != NULL)
++ tt_ptr_op(e, OP_NE, NULL)
+|
+- tt_assert(e == NULL)
++ tt_ptr_op(e, OP_EQ, NULL)
+)