[tor-commits] [tor/master] Add Coccinelle patch for replacing NULL/non-NULL tt_assert().

nickm at torproject.org nickm at torproject.org
Thu Aug 24 20:11:49 UTC 2017


commit 9e1fa959201611b764ac90ce59485d33b8ea975b
Author: Alexander Færøy <ahf at torproject.org>
Date:   Mon Jun 5 15:54:21 2017 +0000

    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().
---
 scripts/coccinelle/test_assert_null.cocci | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/coccinelle/test_assert_null.cocci b/scripts/coccinelle/test_assert_null.cocci
new file mode 100644
index 000000000..3d66e1ee0
--- /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)
+)





More information about the tor-commits mailing list