bintree_iterator_previous.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*********************** -*- Mode: C -*- ***********************
  2. * File : bintree_iterator_previous.c
  3. *---------------------------------------------------------------
  4. * Description
  5. * ===========
  6. * This operation returns the previous "clientnode" in an iteration.
  7. *
  8. * iter - the iterator instance to invoke this operation upon.
  9. *
  10. * RETURNS
  11. * "clientnode" instance or NULL if the iteration has reached the beginning
  12. * of the tree.
  13. *---------------------------------------------------------------
  14. * Author : Graeme McKerrell
  15. * Created On : Wed Jan 28 10:35:19 2004
  16. * Status : TESTED
  17. *---------------------------------------------------------------
  18. * HISTORY
  19. * 7-Dec-2004 Graeme McKerrell
  20. * Renamed to the "lub_" namespace
  21. * 5-May-2004 Graeme McKerrell
  22. * updates following review
  23. * 9-Feb-2004 Graeme McKerrell
  24. * updated to use new key structure
  25. * 28-Jan-2004 Graeme McKerrell
  26. * Initial version
  27. *---------------------------------------------------------------
  28. * Copyright (C) 2004 3Com Corporation. All Rights Reserved.
  29. **************************************************************** */
  30. #include "private.h"
  31. /*--------------------------------------------------------- */
  32. void *
  33. lub_bintree_iterator_previous(lub_bintree_iterator_t *this)
  34. {
  35. void *clientnode = lub_bintree_findprevious(this->tree,&this->key);
  36. /* make sure that next time we've move onward */
  37. lub_bintree_iterator_init(this,this->tree,clientnode);
  38. return clientnode;
  39. }
  40. /*--------------------------------------------------------- */