From 3631c1d814cf845b027cad0e41fcda0f78b5f80e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 21 Jan 2003 08:57:13 +0000 Subject: [PATCH] [! weak_alias]: Define __-prefixed names to publicized ones. [! defined _LIBC]: Define-away weak_alias and internal_function. [defined weak_alias]: Guard each use of weak_alias. --- lib/tsearch.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/tsearch.c b/lib/tsearch.c index 126f143695..12d6a49a44 100644 --- a/lib/tsearch.c +++ b/lib/tsearch.c @@ -88,6 +88,19 @@ #include #include +#ifndef weak_alias +# define __tsearch tsearch +# define __tfind tfind +# define __tdelete tdelete +# define __twalk twalk +# define __tdestroy tdestroy +#endif + +#ifndef _LIBC +# define weak_alias(f,g) +# define internal_function +#endif + typedef struct node_t { /* Callers expect this to be the first element in the structure - do not @@ -105,9 +118,9 @@ typedef const struct node_t *const_node; /* Routines to check tree invariants. */ -#include +# include -#define CHECK_TREE(a) check_tree(a) +# define CHECK_TREE(a) check_tree(a) static void check_tree_recurse (node p, int d_sofar, int d_total) @@ -142,7 +155,7 @@ check_tree (node root) #else -#define CHECK_TREE(a) +# define CHECK_TREE(a) #endif @@ -293,7 +306,9 @@ __tsearch (const void *key, void **vrootp, __compar_fn_t compar) return q; } +#ifdef weak_alias weak_alias (__tsearch, tsearch) +#endif /* Find datum in search tree. @@ -325,7 +340,9 @@ __tfind (key, vrootp, compar) } return NULL; } +#ifdef weak_alias weak_alias (__tfind, tfind) +#endif /* Delete node with given key. @@ -585,7 +602,9 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar) free (unchained); return retval; } +#ifdef weak_alias weak_alias (__tdelete, tdelete) +#endif /* Walk the nodes of a tree. @@ -625,7 +644,9 @@ __twalk (const void *vroot, __action_fn_t action) if (root != NULL && action != NULL) trecurse (root, action, 0); } +#ifdef weak_alias weak_alias (__twalk, twalk) +#endif @@ -654,4 +675,6 @@ __tdestroy (void *vroot, void (*freefct)(void *)) if (root != NULL) tdestroy_recurse (root, freefct); } +#ifdef weak_alias weak_alias (__tdestroy, tdestroy) +#endif -- 2.47.2