X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=include%2Fsearch.h;h=3fa41adc6b2f9b43368f6b5cf57079d39962822e;hp=9254ed0c02e9cd1ba382fb6b5add99bf153cfd07;hb=6f26cf3dacf9d426bbd18cecb4d486da56c17351;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 diff --git a/include/search.h b/include/search.h index 9254ed0c..3fa41adc 100644 --- a/include/search.h +++ b/include/search.h @@ -1,6 +1,47 @@ #ifndef _SEARCH_H #define _SEARCH_H -// FIXME!!! +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#include + +typedef enum { FIND, ENTER } ACTION; +typedef enum { preorder, postorder, endorder, leaf } VISIT; + +typedef struct { + char *key; + void *data; +} ENTRY; + +int hcreate(size_t); +void hdestroy(void); +ENTRY *hsearch(ENTRY, ACTION); + +void insque(void *, void *); +void remque(void *); + +void *lsearch(const void *, void *, size_t *, size_t, + int (*)(const void *, const void *)); +void *lfind(const void *, const void *, size_t *, size_t, + int (*)(const void *, const void *)); + +void *tdelete(const void *, void **, int(*)(const void *, const void *)); +void *tfind(const void *, void *const *, int(*)(const void *, const void *)); +void *tsearch(const void *, void **, int (*)(const void *, const void *)); +void twalk(const void *, void (*)(const void *, VISIT, int)); + +#ifdef _GNU_SOURCE +struct qelem { + struct qelem *q_forw, *q_back; + char q_data[1]; +}; +#endif + +#ifdef __cplusplus +} +#endif #endif