1. 22 Aug, 2016 1 commit
    • Jon Griffiths's avatar
      hex: Simplify hex_encode · 578c4bfb
      Jon Griffiths authored
      The documentation for hex_encode indicates that it returns simply true or
      false. The old implementation was returning the written length on success,
      cast to boolean. This will elicit a warning under MSVC.
      
      On further examination, there is no need to check/modify the length inside
      the loop, since we can check it once before starting. As a result the code
      can be simplified a bit.
      
      A side affect of this change is that nothing will be written at all if the
      length is incorrect, vs the previous code writing characters until the length
      available is exhausted. I prefer the new semantics but YMMV.
      Signed-off-by: default avatarJon Griffiths <jon_p_griffiths@yahoo.com>
      578c4bfb
  2. 28 Jun, 2016 1 commit
  3. 16 Jun, 2016 5 commits
    • David Gibson's avatar
      altstack: Don't log internal calls in test cases · c21a1eff
      David Gibson authored
      altstack/test/run.c uses some hairy macros to intercept the standard
      library functions that altstack uses.  This has two purposes: 1) to
      conditionally cause those functions to fail, and thereby test altstack's
      error paths, and 2) log which of the library functions was called in each
      testcase.
      
      The second function isn't actually useful - for the purposes of testing the
      module, we want to check the actual behaviour, not what calls it made in
      what order to accomplish it.  Explicitly checking the calls makes it much
      harder to change altstack's implementation without breaking the tests.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      c21a1eff
    • David Gibson's avatar
      altstack: Don't use 0 pointer literals · 9683a45f
      David Gibson authored
      In a number of places the altstack module uses a literal '0' for pointer
      values.  That's correct C, but doesn't make it obvious on a quick read
      whether values are integers or pointers.  This patch changes those cases
      to use the NULL define instead.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      9683a45f
    • David Gibson's avatar
      altstack: Use ptrint instead of bare casts · 029a45b8
      David Gibson authored
      Functions invoked with altstack take a void * parameter.  However, the
      test program wants to pass an integer, and so uses the trick of casting
      the integer values to (void *) and back again.
      
      The ptrint() module handles exactly this case in a more portable and
      (somewhat) typesafe way, so use that instead.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      029a45b8
    • David Gibson's avatar
      altstack: Restore alternate signal stack state · 15c555b3
      David Gibson authored
      altstack relies on catching a SIGSEGV caused when overrunning the stack.
      This means that the SEGV handler itself can't use the already overflowed
      stack, and so we use sigaltstack() to assign the signal handler a different
      stack.  On completion, altstack() clears the alternate signal stack.
      
      However, it's possible that the calling program could be using
      sigaltstack() for its own reasons, so it's more correct to restore the
      sigaltstack() state to that from the beginning of the altstack() call.
      This patch implements this behaviour.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      15c555b3
    • David Gibson's avatar
      altstack: Consolidate thread-local variables · 2da0271f
      David Gibson authored
      altstack uses a number of __thread variables to track internal state.  This
      allows altstack to be thread-safe, although it's still not re-entrant.
      This patch gathers all these variables into a single per-thread state
      structure.  This makes it easy to see at a glance what the whole of the
      required state is, and thereby easier to reason about correctness of
      changes to the implementation.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      2da0271f
  4. 06 Jun, 2016 3 commits
  5. 05 Jun, 2016 2 commits
  6. 03 Jun, 2016 1 commit
  7. 02 Jun, 2016 6 commits
  8. 31 May, 2016 3 commits
  9. 09 May, 2016 4 commits
  10. 06 May, 2016 1 commit
  11. 03 May, 2016 2 commits
  12. 29 Apr, 2016 4 commits
  13. 26 Apr, 2016 6 commits
  14. 25 Mar, 2016 1 commit
    • Andrew Jeffery's avatar
      strgrp: Add cosine fudge-curve to unify filter comparison spaces · e8f7a978
      Andrew Jeffery authored
      If we are to use should_grp_score_cos(x,y) as a filter the the following
      relationship must hold (from least to most expensive):
      
              should_grp_score_len(x,y)
                      >= should_grp_score_cos(x,y)
                      >= grp_score(x)
      
      should_grp_score_cos(x,y) wasn't holding up its part of the bargain, so
      real data was used to generate a fudge curve to bring
      should_grp_score_cos(x,y) results into the same space. Really this is a
      terrible hack and the problem needs more thought. Evaluation of
      should_grp_score_cos(x,y)'s performance benefit (given the relaxation of
      the filter under the fudge curve) is sorely needed.
      e8f7a978