/* avl.c - routines to implement an avl tree */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/*
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
#endif
#include <stdio.h>
-#include <stdlib.h>
+#include <ac/stdlib.h>
+#define AVL_INTERNAL
#include "avl.h"
#define ROTATERIGHT(x) { \
Avlnode *tmp;\
if ( *(x) == NULL || (*(x))->avl_left == NULL ) {\
- (void) fputs("RR error\n", stderr); exit(1); \
+ (void) fputs("RR error\n", stderr); exit( EXIT_FAILURE ); \
}\
tmp = (*(x))->avl_left;\
(*(x))->avl_left = tmp->avl_right;\
#define ROTATELEFT(x) { \
Avlnode *tmp;\
if ( *(x) == NULL || (*(x))->avl_right == NULL ) {\
- (void) fputs("RL error\n", stderr); exit(1); \
+ (void) fputs("RL error\n", stderr); exit( EXIT_FAILURE ); \
}\
tmp = (*(x))->avl_right;\
(*(x))->avl_right = tmp->avl_left;\
*/
void*
-avl_find( Avlnode *root, void* data, AVL_CMP fcmp )
+avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
{
int cmp;
*/
void*
-avl_find_lin( Avlnode *root, void* data, AVL_CMP fcmp )
+avl_find_lin( Avlnode *root, const void* data, AVL_CMP fcmp )
{
void* res;
return( avl_find_lin( root->avl_right, data, fcmp ) );
}
+/* NON-REENTRANT INTERFACE */
+
static void* *avl_list;
static int avl_maxlist;
static int avl_nextlist;
return( avl_list[ avl_nextlist++ ] );
}
+/* end non-reentrant code */
+
+
int
avl_dup_error( void* left, void* right )
{