diff options
| author | cvs2svn <admin@example.com> | 2008-07-28 23:44:12 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2008-07-28 23:44:12 +0000 |
| commit | daac2f633f49a45baa8412c5e4e71e594236e7b8 (patch) | |
| tree | c2b7593b6807015d5bd1bbe95841e718a3b3df42 /src/lib/libc/stdlib/tfind.c | |
| parent | 10837c3c47f1b9d7d1a061fff2327a4e280ba338 (diff) | |
| download | openbsd-pre_openssl_0_9_8h.tar.gz openbsd-pre_openssl_0_9_8h.tar.bz2 openbsd-pre_openssl_0_9_8h.zip | |
This commit was manufactured by cvs2git to create tag 'pre_openssl_0_9_8h'.pre_openssl_0_9_8h
Diffstat (limited to 'src/lib/libc/stdlib/tfind.c')
| -rw-r--r-- | src/lib/libc/stdlib/tfind.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/lib/libc/stdlib/tfind.c b/src/lib/libc/stdlib/tfind.c deleted file mode 100644 index ff6bcd742d..0000000000 --- a/src/lib/libc/stdlib/tfind.c +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | /* $OpenBSD: tfind.c,v 1.5 2005/03/30 18:51:49 pat Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Tree search generalized from Knuth (6.2.2) Algorithm T just like | ||
| 5 | * the AT&T man page says. | ||
| 6 | * | ||
| 7 | * The node_t structure is for internal use only, lint doesn't grok it. | ||
| 8 | * | ||
| 9 | * Written by reading the System V Interface Definition, not the code. | ||
| 10 | * | ||
| 11 | * Totally public domain. | ||
| 12 | */ | ||
| 13 | /*LINTLIBRARY*/ | ||
| 14 | #include <search.h> | ||
| 15 | |||
| 16 | typedef struct node_t | ||
| 17 | { | ||
| 18 | char *key; | ||
| 19 | struct node_t *llink, *rlink; | ||
| 20 | } node; | ||
| 21 | |||
| 22 | /* find a node, or return 0 */ | ||
| 23 | void * | ||
| 24 | tfind(const void *vkey, void * const *vrootp, | ||
| 25 | int (*compar)(const void *, const void *)) | ||
| 26 | { | ||
| 27 | char *key = (char *)vkey; | ||
| 28 | node **rootp = (node **)vrootp; | ||
| 29 | |||
| 30 | if (rootp == (struct node_t **)0) | ||
| 31 | return ((struct node_t *)0); | ||
| 32 | while (*rootp != (struct node_t *)0) { /* T1: */ | ||
| 33 | int r; | ||
| 34 | if ((r = (*compar)(key, (*rootp)->key)) == 0) /* T2: */ | ||
| 35 | return (*rootp); /* key found */ | ||
| 36 | rootp = (r < 0) ? | ||
| 37 | &(*rootp)->llink : /* T3: follow left branch */ | ||
| 38 | &(*rootp)->rlink; /* T4: follow right branch */ | ||
| 39 | } | ||
| 40 | return (node *)0; | ||
| 41 | } | ||
