aboutsummaryrefslogtreecommitdiff
path: root/system/include/libc/search.h
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2013-08-04 00:32:45 +0800
committerAlon Zakai <alonzakai@gmail.com>2013-09-13 10:07:02 -0700
commit5c6e1633d218bd5b9c5077634829eb14d326308f (patch)
tree50a4fd55b51a0fab6506addf610a666afabaec9b /system/include/libc/search.h
parent27d496610e0ef93c9805a6a1a77de3f053405c6b (diff)
Update libc headers to use musl headers.
Diffstat (limited to 'system/include/libc/search.h')
-rw-r--r--system/include/libc/search.h88
1 files changed, 40 insertions, 48 deletions
diff --git a/system/include/libc/search.h b/system/include/libc/search.h
index c78ce184..ebfe08a2 100644
--- a/system/include/libc/search.h
+++ b/system/include/libc/search.h
@@ -1,59 +1,51 @@
-/* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */
-/* $FreeBSD: src/include/search.h,v 1.4 2002/03/23 17:24:53 imp Exp $ */
+#ifndef _SEARCH_H
+#define _SEARCH_H
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>
- * Public domain.
- */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
-#ifndef _SEARCH_H_
-#define _SEARCH_H_
+#define __NEED_size_t
+#include <bits/alltypes.h>
-#include <sys/cdefs.h>
-#include <machine/ansi.h>
-#include <sys/types.h>
+typedef enum { FIND, ENTER } ACTION;
+typedef enum { preorder, postorder, endorder, leaf } VISIT;
-typedef struct entry {
+typedef struct {
char *key;
void *data;
} ENTRY;
-typedef enum {
- FIND, ENTER
-} ACTION;
-
-typedef enum {
- preorder,
- postorder,
- endorder,
- leaf
-} VISIT;
-
-#ifdef _SEARCH_PRIVATE
-typedef struct node {
- char *key;
- struct node *llink, *rlink;
-} node_t;
-#endif
+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));
-struct hsearch_data
-{
- struct internal_head *htable;
- size_t htablesize;
+#ifdef _GNU_SOURCE
+struct qelem {
+ struct qelem *q_forw, *q_back;
+ char q_data[1];
};
-__BEGIN_DECLS
-int hcreate(size_t);
-void hdestroy(void);
-ENTRY *hsearch(ENTRY, ACTION);
-int hcreate_r(size_t, struct hsearch_data *);
-void hdestroy_r(struct hsearch_data *);
-int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
-void *tdelete(const void *, void **, int (*)(const void *, const void *));
-void tdestroy (void *, void (*)(void *));
-void *tfind(const void *, void **, int (*)(const void *, const void *));
-void *tsearch(const void *, void **, int (*)(const void *, const void *));
-void twalk(const void *, void (*)(const void *, VISIT, int));
-__END_DECLS
-
-#endif /* !_SEARCH_H_ */
+void tdestroy(void *, void (*)(void *));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif