haiku/headers/posix/search.h
Augustin Cavalier 90dca2bc8e headers: Change most remaining include guards to _DEFAULT_SOURCE.
We automatically enable _DEFAULT_SOURCE if _GNU_SOURCE is defined.
Rather than having even more optional methods undefined unless
_GNU_SOURCE manually is, just change all remaining guarts to
use _DEFAULT_SOURCE instead.

Fixes #19095.

Change-Id: I5c7baf40b7fb37913e24279589fc1ae706448a45
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8330
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-09-19 16:43:31 +00:00

61 lines
1.4 KiB
C

/*
* Copyright 2008-2012 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SEARCH_H_
#define _SEARCH_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;
#ifdef __cplusplus
extern "C" {
#endif
extern int hcreate(size_t elementCount);
extern void hdestroy(void);
extern ENTRY *hsearch(ENTRY iteam, ACTION action);
extern void insque(void *element, void *insertAfter);
extern void *lfind(const void *key, const void *base, size_t *_elementCount,
size_t width, int (*compareFunction)(const void *, const void *));
extern void *lsearch(const void *key, void *base, size_t *_elementCount,
size_t width, int (*compareFunction)(const void *, const void *));
extern void remque(void *element);
extern void *tdelete(const void *key, void **_root,
int (*compare)(const void *, const void *));
extern void *tfind(const void *key, void *const *root,
int (*compare)(const void *, const void *));
extern void *tsearch(const void *key, void **_root,
int (*compare)(const void *, const void *));
extern void twalk(const void *root,
void (*action)(const void *, VISIT, int ));
#ifdef _DEFAULT_SOURCE
extern void tdestroy(void *root, void (*free_key)(void *));
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SEARCH_H_ */