Skip to content
Snippets Groups Projects
Commit 322bb86f authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

#ifdef out non-reentrant prototypes.

Only testavl uses this interface.
parent a641a926
No related branches found
No related tags found
No related merge requests found
...@@ -70,14 +70,10 @@ avl_find LDAP_P((Avlnode *, void*, AVL_CMP)); ...@@ -70,14 +70,10 @@ avl_find LDAP_P((Avlnode *, void*, AVL_CMP));
LDAP_F( void* ) LDAP_F( void* )
avl_find_lin LDAP_P((Avlnode *, void*, AVL_CMP)); avl_find_lin LDAP_P((Avlnode *, void*, AVL_CMP));
#ifdef AVL_NONREENTRANT
LDAP_F( void* ) LDAP_F( void* )
avl_getfirst LDAP_P((Avlnode *)); avl_getfirst LDAP_P((Avlnode *));
#ifdef AVL_REENTRANT
/* ??? avl.c does not provide this version ??? */
LDAP_F( void* )
avl_getnext LDAP_P((Avlnode *, void* ));
#else
LDAP_F( void* ) LDAP_F( void* )
avl_getnext LDAP_P((void)); avl_getnext LDAP_P((void));
#endif #endif
......
...@@ -664,6 +664,8 @@ avl_find_lin( Avlnode *root, void* data, AVL_CMP fcmp ) ...@@ -664,6 +664,8 @@ avl_find_lin( Avlnode *root, void* data, AVL_CMP fcmp )
return( avl_find_lin( root->avl_right, data, fcmp ) ); return( avl_find_lin( root->avl_right, data, fcmp ) );
} }
/* NON-REENTRANT INTERFACE */
static void* *avl_list; static void* *avl_list;
static int avl_maxlist; static int avl_maxlist;
static int avl_nextlist; static int avl_nextlist;
...@@ -736,6 +738,9 @@ avl_getnext( void ) ...@@ -736,6 +738,9 @@ avl_getnext( void )
return( avl_list[ avl_nextlist++ ] ); return( avl_list[ avl_nextlist++ ] );
} }
/* end non-reentrant code */
int int
avl_dup_error( void* left, void* right ) avl_dup_error( void* left, void* right )
{ {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <ac/string.h> #include <ac/string.h>
#define AVL_NONREENTRANT
#include "avl.h" #include "avl.h"
static void ravl_print LDAP_P(( Avlnode *root, int depth )); static void ravl_print LDAP_P(( Avlnode *root, int depth ));
...@@ -31,11 +32,16 @@ main( int argc, char **argv ) ...@@ -31,11 +32,16 @@ main( int argc, char **argv )
( void ) myprint( tree ); ( void ) myprint( tree );
break; break;
case 't': /* traverse with first, next */ case 't': /* traverse with first, next */
#ifdef AVL_NONREENTRANT
printf( "***\n" ); printf( "***\n" );
for ( p = (char * ) avl_getfirst( tree ); for ( p = (char * ) avl_getfirst( tree );
p != NULL; p = (char *) avl_getnext( /* tree, p */ ) ) p != NULL;
p = (char *) avl_getnext())
printf( "%s\n", p ); printf( "%s\n", p );
printf( "***\n" ); printf( "***\n" );
#else
printf( "*** reentrant interface not implemented ***" );
#endif
break; break;
case 'f': /* find */ case 'f': /* find */
printf( "data? " ); printf( "data? " );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment