platform_bionic/libc/include/search.h
Elliott Hughes cc0fe6e8c0 The future is now (2018 edition).
Bug: N/A
Test: builds
Change-Id: Ic638e5b1f4e5901885fe7bc60b2a265817636b21
2018-01-30 08:54:12 -08:00

66 lines
1.9 KiB
C

/*-
* Written by J.T. Conklin <jtc@netbsd.org>
* Public domain.
*
* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $
* $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $
*/
#ifndef _SEARCH_H_
#define _SEARCH_H_
#include <sys/cdefs.h>
#include <sys/types.h>
typedef enum {
FIND,
ENTER
} ACTION;
typedef struct entry {
char* key;
void* data;
} ENTRY;
typedef enum {
preorder,
postorder,
endorder,
leaf
} VISIT;
#if defined(__USE_BSD) || defined(__USE_GNU)
struct hsearch_data {
struct __hsearch* __hsearch;
};
#endif
__BEGIN_DECLS
void insque(void* __element, void* __previous) __INTRODUCED_IN(21);
void remque(void* __element) __INTRODUCED_IN(21);
int hcreate(size_t) __INTRODUCED_IN(28);
void hdestroy(void) __INTRODUCED_IN(28);
ENTRY* hsearch(ENTRY, ACTION) __INTRODUCED_IN(28);
#if defined(__USE_BSD) || defined(__USE_GNU)
int hcreate_r(size_t, struct hsearch_data*) __INTRODUCED_IN(28);
void hdestroy_r(struct hsearch_data*) __INTRODUCED_IN(28);
int hsearch_r(ENTRY, ACTION, ENTRY**, struct hsearch_data*) __INTRODUCED_IN(28);
#endif
void* lfind(const void* __key, const void* __base, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*))
__INTRODUCED_IN(21);
void* lsearch(const void* __key, void* __base, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*))
__INTRODUCED_IN(21);
void* tdelete(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
void tdestroy(void* __root, void (*__free_fn)(void*)) __INTRODUCED_IN(16);
void* tfind(const void* __key, void* const* __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
void* tsearch(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
void twalk(const void* __root, void (*__visitor)(const void*, VISIT, int)) __INTRODUCED_IN(21);
__END_DECLS
#endif