1. 08 Dec, 2017 1 commit
  2. 14 Sep, 2017 1 commit
    • Taylor Yu's avatar
      Refactor control_event_bootstrap_problem · 818332e7
      Taylor Yu authored
      Change the contract of control_event_bootstrap_problem() to be more
      general and to take a connection_t.  New function
      control_event_bootstrap_prob_or() has the specific or_connection_t
      funcionality previously used.
      818332e7
  3. 05 Sep, 2017 2 commits
    • Nick Mathewson's avatar
      Refactor buffer APIs to put a buf_t first. · 6ec50597
      Nick Mathewson authored
      By convention, a function that frobs a foo_t should be called
      foo_frob, and it should have a foo_t * as its first argument.  But
      for many of the buf_t functions, the buf_t was the final argument,
      which is silly.
      6ec50597
    • Nick Mathewson's avatar
      Repair buffer API so everything starts with buf_. · 4a7e90ad
      Nick Mathewson authored
      Our convention is that functions which manipulate a type T should be
      named T_foo.  But the buffer functions were super old, and followed
      all kinds of conventions.  Now they're uniform.
      
      Here's the perl I used to do this:
      
      \#!/usr/bin/perl -w -i -p
      
      s/read_to_buf\(/buf_read_from_socket\(/;
      s/flush_buf\(/buf_flush_to_socket\(/;
      s/read_to_buf_tls\(/buf_read_from_tls\(/;
      s/flush_buf_tls\(/buf_flush_to_tls\(/;
      s/write_to_buf\(/buf_add\(/;
      s/write_to_buf_compress\(/buf_add_compress\(/;
      s/move_buf_to_buf\(/buf_move_to_buf\(/;
      s/peek_from_buf\(/buf_peek\(/;
      s/fetch_from_buf\(/buf_get_bytes\(/;
      s/fetch_from_buf_line\(/buf_get_line\(/;
      s/fetch_from_buf_line\(/buf_get_line\(/;
      s/buf_remove_from_front\(/buf_drain\(/;
      s/peek_buf_startswith\(/buf_peek_startswith\(/;
      s/assert_buf_ok\(/buf_assert_ok\(/;
      4a7e90ad
  4. 27 Apr, 2017 1 commit
  5. 15 Mar, 2017 1 commit
  6. 27 Feb, 2016 1 commit
  7. 26 Nov, 2015 1 commit
  8. 02 Jan, 2015 1 commit
  9. 12 Nov, 2014 2 commits
  10. 28 Oct, 2014 1 commit
  11. 16 Sep, 2014 2 commits
    • Nick Mathewson's avatar
    • Nick Mathewson's avatar
      Use coccinelle scripts to clean up our unit tests · 02438957
      Nick Mathewson authored
      This should get rid of most of the users of the old test_*
      functions.  Some are in macros and will need manual cleanup, though.
      
      This patch is for 13119, and was automatically generated with these
      scripts.  The perl scripts are there because coccinelle hates
      operators as macro arguments.
      
      ------------------------------
      
      s/==,/_X_EQ_,/g;
      s/!=,/_X_NE_,/g;
      s/<,/_X_LT_,/g;
      s/>,/_X_GT_,/g;
      s/>=,/_X_GEQ_,/g;
      s/<=,/_X_LEQ_,/g;
      
      ------------------------------
      @@
      expression a;
      identifier func;
      @@
       func (...) {
      <...
      -test_fail_msg
      +TT_DIE
       (
      +(
       a
      +)
       )
       ...>
       }
      
      @@
      identifier func;
      @@
       func (...) {
      <...
      -test_fail()
      +TT_DIE(("Assertion failed."))
       ...>
       }
      
      @@
      expression a;
      identifier func;
      @@
       func (...) {
      <...
      -test_assert
      +tt_assert
      	(a)
       ...>
       }
      
      @@
      expression a, b;
      identifier func;
      @@
       func (...) {
      <...
      -test_eq
      +tt_int_op
       (a,
      +_X_EQ_,
        b)
       ...>
       }
      
      @@
      expression a, b;
      identifier func;
      @@
       func (...) {
      <...
      -test_neq
      +tt_int_op
       (a,
      +_X_NEQ_,
        b)
       ...>
       }
      
      @@
      expression a, b;
      identifier func;
      @@
       func (...) {
      <...
      -test_streq
      +tt_str_op
       (a,
      +_X_EQ_,
        b)
       ...>
       }
      
      @@
      expression a, b;
      identifier func;
      @@
       func (...) {
      <...
      -test_strneq
      +tt_str_op
       (a,
      +_X_NEQ_,
        b)
       ...>
       }
      
      @@
      expression a, b;
      identifier func;
      @@
       func (...) {
      <...
      -test_eq_ptr
      +tt_ptr_op
       (a,
      +_X_EQ_,
        b)
       ...>
       }
      
      @@
      expression a, b;
      identifier func;
      @@
       func() {
      <...
      -test_neq_ptr
      +tt_ptr_op
       (a,
      +_X_NEQ_,
        b)
       ...>
       }
      
      @@
      expression a, b, len;
      identifier func;
      @@
       func (...) {
      <...
      -test_memeq
      +tt_mem_op
       (a,
      +_X_EQ_,
        b, len)
       ...>
       }
      
      @@
      expression a, b, len;
      identifier func;
      @@
       func (...) {
      <...
      -test_memneq
      +tt_mem_op
       (a,
      +_X_NEQ_,
        b, len)
       ...>
       }
      
      ------------------------------
      @@
      char a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a == b
      +a, _X_EQ_, b
       )
       ...>
      }
      
      @@
      int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a == b
      +a, _X_EQ_, b
       )
       ...>
      }
      
      @@
      long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a == b
      +a, _X_EQ_, b
       )
       ...>
      }
      
      @@
      unsigned int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a == b
      +a, _X_EQ_, b
       )
       ...>
      }
      
      @@
      unsigned long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a == b
      +a, _X_EQ_, b
       )
       ...>
      }
      
      @@
      char a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a != b
      +a, _X_NEQ_, b
       )
       ...>
      }
      
      @@
      int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a != b
      +a, _X_NEQ_, b
       )
       ...>
      }
      
      @@
      long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a != b
      +a, _X_NEQ_, b
       )
       ...>
      }
      
      @@
      unsigned int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a != b
      +a, _X_NEQ_, b
       )
       ...>
      }
      
      @@
      unsigned long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a != b
      +a, _X_NEQ_, b
       )
       ...>
      }
      
      @@
      char a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a >= b
      +a, _X_GEQ_, b
       )
       ...>
      }
      
      @@
      int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a >= b
      +a, _X_GEQ_, b
       )
       ...>
      }
      
      @@
      long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a >= b
      +a, _X_GEQ_, b
       )
       ...>
      }
      
      @@
      unsigned int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a >= b
      +a, _X_GEQ_, b
       )
       ...>
      }
      
      @@
      unsigned long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a >= b
      +a, _X_GEQ_, b
       )
       ...>
      }
      
      @@
      char a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a <= b
      +a, _X_LEQ_, b
       )
       ...>
      }
      
      @@
      int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a <= b
      +a, _X_LEQ_, b
       )
       ...>
      }
      
      @@
      long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a <= b
      +a, _X_LEQ_, b
       )
       ...>
      }
      
      @@
      unsigned int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a <= b
      +a, _X_LEQ_, b
       )
       ...>
      }
      
      @@
      unsigned long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a <= b
      +a, _X_LEQ_, b
       )
       ...>
      }
      
      @@
      char a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a > b
      +a, _X_GT_, b
       )
       ...>
      }
      
      @@
      int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a > b
      +a, _X_GT_, b
       )
       ...>
      }
      
      @@
      long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a > b
      +a, _X_GT_, b
       )
       ...>
      }
      
      @@
      unsigned int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a > b
      +a, _X_GT_, b
       )
       ...>
      }
      
      @@
      unsigned long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a > b
      +a, _X_GT_, b
       )
       ...>
      }
      
      @@
      char a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a < b
      +a, _X_LT_, b
       )
       ...>
      }
      
      @@
      int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a < b
      +a, _X_LT_, b
       )
       ...>
      }
      
      @@
      long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_int_op
       (
      -a < b
      +a, _X_LT_, b
       )
       ...>
      }
      
      @@
      unsigned int a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a < b
      +a, _X_LT_, b
       )
       ...>
      }
      
      @@
      unsigned long a, b;
      identifier func;
      @@
       func (...) {
      <...
      -tt_assert
      +tt_uint_op
       (
      -a < b
      +a, _X_LT_, b
       )
       ...>
      }
      
      ------------------------------
      
      s/_X_NEQ_/!=/g;
      s/_X_NE_/!=/g;
      s/_X_EQ_/==/g;
      s/_X_GT_/>/g;
      s/_X_LT_/</g;
      s/_X_GEQ_/>=/g;
      s/_X_LEQ_/<=/g;
      
      s/test_mem_op\(/tt_mem_op\(/g;
      02438957
  12. 08 May, 2014 2 commits
  13. 29 Apr, 2014 1 commit
  14. 27 Mar, 2014 1 commit
  15. 10 Mar, 2014 1 commit
  16. 15 Aug, 2013 11 commits