From f704f1c475636cbcea7ff83164aeac06a6e1fca8 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Mon, 31 May 1999 20:40:42 +0000
Subject: [PATCH] (barely) hide AVL internals

---
 include/avl.h              | 8 ++++++--
 libraries/libavl/avl.c     | 1 +
 libraries/libavl/testavl.c | 5 +++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/avl.h b/include/avl.h
index 58b3d972de..aa9f58f66f 100644
--- a/include/avl.h
+++ b/include/avl.h
@@ -32,12 +32,15 @@
 
 LDAP_BEGIN_DECL
 
-typedef struct avlnode {
+typedef struct avlnode Avlnode;
+
+#ifdef AVL_INTERNAL
+struct avlnode {
 	void*		avl_data;
 	signed char		avl_bf;
 	struct avlnode	*avl_left;
 	struct avlnode	*avl_right;
-} Avlnode;
+};
 
 #define NULLAVL	((Avlnode *) NULL)
 
@@ -45,6 +48,7 @@ typedef struct avlnode {
 #define LH 	(-1)
 #define EH 	0
 #define RH 	1
+#endif
 
 /* avl routines */
 #define avl_getone(x)	((x) == 0 ? 0 : (x)->avl_data)
diff --git a/libraries/libavl/avl.c b/libraries/libavl/avl.c
index 08cd7ed7b7..adce228dd7 100644
--- a/libraries/libavl/avl.c
+++ b/libraries/libavl/avl.c
@@ -21,6 +21,7 @@ static char avl_version[] = "AVL library version 1.0\n";
 #include <stdio.h>
 #include <stdlib.h>
 
+#define AVL_INTERNAL
 #include "avl.h"
 
 #define ROTATERIGHT(x)	{ \
diff --git a/libraries/libavl/testavl.c b/libraries/libavl/testavl.c
index 8183e167b3..3b927d9807 100644
--- a/libraries/libavl/testavl.c
+++ b/libraries/libavl/testavl.c
@@ -7,6 +7,7 @@
 
 #include <ac/string.h>
 
+#define AVL_INTERNAL
 #define AVL_NONREENTRANT 
 #include "avl.h"
 
@@ -16,7 +17,7 @@ static void myprint LDAP_P(( Avlnode *root ));
 int
 main( int argc, char **argv )
 {
-	Avlnode	*tree = NULLAVL;
+	Avlnode	*tree = NULL;
 	char	command[ 10 ];
 	char	name[ 80 ];
 	char	*p;
@@ -26,7 +27,7 @@ main( int argc, char **argv )
 		switch( *command ) {
 		case 'n':	/* new tree */
 			( void ) avl_free( tree, (AVL_FREE) free );
-			tree = NULLAVL;
+			tree = NULL;
 			break;
 		case 'p':	/* print */
 			( void ) myprint( tree );
-- 
GitLab