Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

  1. /* $OpenBSD: search.h,v 1.8 2006/01/06 18:53:04 millert Exp $ */
  2. /* $NetBSD: search.h,v 1.9 1995/08/08 21:14:45 jtc Exp $ */
  3. /*
  4. * Written by J.T. Conklin <jtc@netbsd.org>
  5. * Public domain.
  6. */
  7. #ifndef _SEARCH_H_
  8. #define _SEARCH_H_
  9. #include <sys/cdefs.h>
  10. #include <machine/_types.h>
  11. #ifndef _SIZE_T_DEFINED_
  12. #define _SIZE_T_DEFINED_
  13. typedef __size_t size_t;
  14. #endif
  15. typedef struct entry {
  16. char *key;
  17. void *data;
  18. } ENTRY;
  19. typedef enum {
  20. FIND, ENTER
  21. } ACTION;
  22. typedef enum {
  23. preorder,
  24. postorder,
  25. endorder,
  26. leaf
  27. } VISIT;
  28. __BEGIN_DECLS
  29. void *bsearch(const void *, const void *, size_t, size_t,
  30. int (*)(const void *, const void *));
  31. int hcreate(size_t);
  32. void hdestroy(void);
  33. ENTRY *hsearch(ENTRY, ACTION);
  34. void *lfind(const void *, const void *, size_t *, size_t,
  35. int (*)(const void *, const void *));
  36. void *lsearch(const void *, const void *, size_t *, size_t,
  37. int (*)(const void *, const void *));
  38. void insque(void *, void *);
  39. void remque(void *);
  40. void *tdelete(const void *, void **,
  41. int (*)(const void *, const void *));
  42. void *tfind(const void *, void * const *,
  43. int (*)(const void *, const void *));
  44. void *tsearch(const void *, void **,
  45. int (*)(const void *, const void *));
  46. void twalk(const void *, void (*)(const void *, VISIT, int));
  47. __END_DECLS
  48. #endif /* !_SEARCH_H_ */