bintree_init.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*********************** -*- Mode: C -*- ***********************
  2. * File : bintree_init.c
  3. *---------------------------------------------------------------
  4. * Description
  5. * ===========
  6. * This operations initialise an instance of a binary tree at runtime.
  7. *
  8. * this - the "tree" instance to initialise
  9. *
  10. * offset - the offset of the node structure within the clients
  11. * structure. This is typically passed using the offsetof() macro.
  12. *
  13. * compareFn - a comparison function for comparing a "clientnode"
  14. * with a "clientkey"
  15. *
  16. * getkeyFn - a function which will fill out a "key" from a clientnode
  17. *
  18. * RETURNS
  19. * none
  20. *---------------------------------------------------------------
  21. * Author : Graeme McKerrell
  22. * Created On : Wed Jan 28 09:54:37 2004
  23. * Status : TESTED
  24. *---------------------------------------------------------------
  25. * HISTORY
  26. * 7-Dec-2004 Graeme McKerrell
  27. * Renamed to the "lub_" namespace
  28. * 5-May-2004 Graeme McKerrell
  29. * updates following review
  30. * 9-Feb-2004 Graeme McKerrell
  31. * update to remove spurious key_storage parameter
  32. * 28-Jan-2004 Graeme McKerrell
  33. * Initial version
  34. *---------------------------------------------------------------
  35. * Copyright (C) 2004 3Com Corporation. All Rights Reserved.
  36. **************************************************************** */
  37. #include "private.h"
  38. /*--------------------------------------------------------- */
  39. void
  40. lub_bintree_init(lub_bintree_t * this,
  41. size_t node_offset,
  42. lub_bintree_compare_fn compareFn,
  43. lub_bintree_getkey_fn getkeyFn)
  44. {
  45. this->root = NULL;
  46. this->node_offset = node_offset;
  47. this->compareFn = compareFn;
  48. this->getkeyFn = getkeyFn;
  49. }
  50. /*--------------------------------------------------------- */