Deleted Added
full compact
tdelete.c (101882) tdelete.c (103012)
1/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem 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
14#include <sys/cdefs.h>
15#if 0
16#if defined(LIBC_SCCS) && !defined(lint)
17__RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $");
18#endif /* LIBC_SCCS and not lint */
19#endif
1/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem 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
14#include <sys/cdefs.h>
15#if 0
16#if defined(LIBC_SCCS) && !defined(lint)
17__RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $");
18#endif /* LIBC_SCCS and not lint */
19#endif
20__FBSDID("$FreeBSD: head/lib/libc/stdlib/tdelete.c 101882 2002-08-14 21:16:41Z robert $");
20__FBSDID("$FreeBSD: head/lib/libc/stdlib/tdelete.c 103012 2002-09-06 11:24:06Z tjr $");
21
22#include <assert.h>
23#define _SEARCH_PRIVATE
24#include <search.h>
25#include <stdlib.h>
26
27
28/*
29 * delete node with given key
30 *
31 * vkey: key to be deleted
32 * vrootp: address of the root of the tree
33 * compar: function to carry out node comparisons
34 */
35void *
21
22#include <assert.h>
23#define _SEARCH_PRIVATE
24#include <search.h>
25#include <stdlib.h>
26
27
28/*
29 * delete node with given key
30 *
31 * vkey: key to be deleted
32 * vrootp: address of the root of the tree
33 * compar: function to carry out node comparisons
34 */
35void *
36tdelete(const void *__restrict vkey, void **__restrict vrootp,
36tdelete(const void * __restrict vkey, void ** __restrict vrootp,
37 int (*compar)(const void *, const void *))
38{
39 node_t **rootp = (node_t **)vrootp;
40 node_t *p, *q, *r;
41 int cmp;
42
43 if (rootp == NULL || (p = *rootp) == NULL)
44 return NULL;

--- 28 unchanged lines hidden ---
37 int (*compar)(const void *, const void *))
38{
39 node_t **rootp = (node_t **)vrootp;
40 node_t *p, *q, *r;
41 int cmp;
42
43 if (rootp == NULL || (p = *rootp) == NULL)
44 return NULL;

--- 28 unchanged lines hidden ---