tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

test-operator-cleanup (785B)


      1 #!/usr/bin/perl -w -p -i
      2 #
      3 # Copyright (c) 2001 Matej Pfajfar.
      4 # Copyright (c) 2001-2004, Roger Dingledine.
      5 # Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
      6 # Copyright (c) 2007-2019, The Tor Project, Inc.
      7 # See LICENSE for licensing information
      8 
      9 # This script looks for instances of C comparison operators as macro arguments,
     10 # and replaces them with our OP_* equivalents.
     11 #
     12 # Some macros that take operators are our tt_int_op() testing macro, and the
     13 # standard timercmp() macro.  Coccinelle can't handle their syntax, however,
     14 # unless we give them their operators as a macro too.
     15 
     16 next if m#^ */\*# or m#^ *\* #;
     17 
     18 s/<([,)])/OP_LT$1/;
     19 s/(?<=[\s,])>([,)])/OP_GT$1/;
     20 #s/>([,)])/OP_GT$1/;
     21 s/==([,)])/OP_EQ$1/;
     22 s/>=([,)])/OP_GE$1/;
     23 s/<=([,)])/OP_LE$1/;
     24 s/!=([,)])/OP_NE$1/;