1. 25 Jun, 2015 1 commit
  2. 18 Jun, 2015 5 commits
    • David Gibson's avatar
      avl: Use definitions from order module · 712dc43d
      David Gibson authored
      The AvlCompare type defined in the avl module is identical in signature to
      the compare function used by qsort() and bsearch().  That has a common
      definition in the new order module, so use that rather than defining its
      own.
      
      In addition use the standard comparison functions from order where possible
      for the avl test code.
      
      Cc: Joey Adams <joeyadams3.14159@gmail.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      712dc43d
    • 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
  3. 13 Jun, 2015 2 commits
  4. 04 Jun, 2015 1 commit
  5. 02 Jun, 2015 1 commit
  6. 01 Jun, 2015 2 commits
  7. 28 May, 2015 4 commits
  8. 27 May, 2015 4 commits
  9. 25 May, 2015 9 commits
  10. 24 May, 2015 1 commit
  11. 20 May, 2015 2 commits
  12. 19 May, 2015 4 commits
  13. 14 May, 2015 1 commit
  14. 12 May, 2015 1 commit
  15. 05 May, 2015 1 commit
  16. 25 Apr, 2015 1 commit