]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add script for cleaning op operator usage in test files.
authorAlexander Færøy <ahf@torproject.org>
Mon, 5 Jun 2017 14:20:39 +0000 (14:20 +0000)
committerNick Mathewson <nickm@torproject.org>
Thu, 24 Aug 2017 19:19:11 +0000 (15:19 -0400)
This patch adds a script written by Nick for bug #13172 to clean up the
usage of ==, !=, <, >, <=, and >= by replacing them with their symbolic
OP_* counterpart. This will ensure that a tool like Coccinelle doesn't
get confused and silently ignore large blocks of code.

scripts/coccinelle/test-operator-cleanup [new file with mode: 0755]

diff --git a/scripts/coccinelle/test-operator-cleanup b/scripts/coccinelle/test-operator-cleanup
new file mode 100755 (executable)
index 0000000..e782254
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/perl -w -p -i
+
+next if m#^ */\*# or m#^ *\* #;
+
+s/<([,)])/OP_LT$1/;
+s/(?<=[\s,])>([,)])/OP_GT$1/;
+#s/>([,)])/OP_GT$1/;
+s/==([,)])/OP_EQ$1/;
+s/>=([,)])/OP_GE$1/;
+s/<=([,)])/OP_LE$1/;
+s/!=([,)])/OP_NE$1/;