X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=include%2Fsearch.h;h=ebfe08a22756020eeaae7f004108c0789b31ae8f;hp=9254ed0c02e9cd1ba382fb6b5add99bf153cfd07;hb=5271ff46b9e983bec5fd9ab79d5aaf096fa54157;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 diff --git a/include/search.h b/include/search.h index 9254ed0c..ebfe08a2 100644 --- a/include/search.h +++ b/include/search.h @@ -1,6 +1,51 @@ #ifndef _SEARCH_H #define _SEARCH_H -// FIXME!!! +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#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 *__restrict, void **__restrict, 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]; +}; + +void tdestroy(void *, void (*)(void *)); +#endif + +#ifdef __cplusplus +} +#endif #endif