1. 18 Jun, 2015 4 commits
    • David Gibson's avatar
      asort: Use order module definitions · 918a733f
      David Gibson authored
      The asort routine takes a user-supplied comparison function.  Use the
      definitions from the new order module to slightly simplify the declaration
      and handling of this function.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      918a733f
    • David Gibson's avatar
      order: Scalar comparison functions · 37825438
      David Gibson authored
      Extend the order module to provide simple, standard, comparison
      callbacks for scalar types (i.e. integer and floating point types).
      
      In addition to the usual variants comparing a plain scalar, this also
      provides helper macros to construct a suitably typed callback and context
      pointer to order structures by a specified scalar field.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      37825438
    • David Gibson's avatar
      order: Module for comparison callbacks · c2a3098b
      David Gibson authored
      Many common algorithms take a callback for comparing items - effectively
      giving the items a user defined order.
      
      For example, the standard library qsort() and bsearch() routines take such
      a callback.  The ccan/avl module takes an identical one.  The ccan/asort
      and ccan/asearch modules use a different variant: their callback takes an
      additional context parameter, and is also typed via use of macros and
      typesafe_cb.
      
      This module provides helper types and macros for easily declaring any of
      the common variants on comparison functions: the 2-parameter untyped form
      (as used by qsort), the 3-parameter untyped form (used by the asort back
      end) and the 3-parameter typed form (used by the asort front end).  It
      provides a wrapper macro for doing the typesafe_cb conversion from
      3-parameter typed to 3-parameter untyped.
      
      It also provides a container struct to describe both a comparison callback
      and a context value as a single structure.  This also comes in both
      untyped and typed variants.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      c2a3098b
    • Rusty Russell's avatar
      ccanlint: handle circular test-depends. · 04b63db6
      Rusty Russell authored
      eg. asort depends on order, but order testdepends on asort.
      
      Probably not the greatest thing to do, but don't barf because of it.
      Reported-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      04b63db6
  2. 13 Jun, 2015 2 commits
  3. 04 Jun, 2015 1 commit
  4. 02 Jun, 2015 1 commit
  5. 01 Jun, 2015 2 commits
  6. 28 May, 2015 4 commits
  7. 27 May, 2015 4 commits
  8. 25 May, 2015 9 commits
  9. 24 May, 2015 1 commit
  10. 20 May, 2015 2 commits
  11. 19 May, 2015 4 commits
  12. 14 May, 2015 1 commit
  13. 12 May, 2015 1 commit
  14. 05 May, 2015 1 commit
  15. 25 Apr, 2015 1 commit
  16. 24 Apr, 2015 2 commits