X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Favl.h;h=e811648a73b7df78f4dde563cff50b4cdd2fe315;hb=59e9ff6243465640956b58ad1756a3ede53eca7c;hp=56eb72bf9c873858f23b768c612e0f32e7fd005a;hpb=bfbc6fe4a6e515189962aebba517138d909fbfed;p=openldap diff --git a/include/avl.h b/include/avl.h index 56eb72bf9c..e811648a73 100644 --- a/include/avl.h +++ b/include/avl.h @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2014 The OpenLDAP Foundation. + * Copyright 1998-2018 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,9 +50,16 @@ struct avlnode { #define avl_lbit avl_bits[0] #define avl_rbit avl_bits[1] -#ifdef AVL_INTERNAL +typedef struct tavlnode TAvlnode; -#define NULLAVL ((Avlnode *) NULL) +struct tavlnode { + void* avl_data; + struct tavlnode *avl_link[2]; + char avl_bits[2]; + signed char avl_bf; +}; + +#ifdef AVL_INTERNAL /* balance factor values */ #define LH (-1) @@ -62,8 +69,8 @@ struct avlnode { #define avl_bf2str(bf) ((bf) == -1 ? "LH" : (bf) == 0 ? "EH" : (bf) == 1 ? "RH" : "(unknown)" ) /* thread bits */ -#define AVL_THREAD 0 -#define AVL_CHILD 1 +#define AVL_CHILD 0 +#define AVL_THREAD 1 /* avl routines */ #define avl_getone(x) ((x) == 0 ? 0 : (x)->avl_data) @@ -120,31 +127,31 @@ LDAP_AVL_F( int ) avl_prefixapply LDAP_P((Avlnode *, void*, AVL_CMP, void*, AVL_CMP, void*, int)); LDAP_AVL_F( int ) -tavl_free LDAP_P(( Avlnode *root, AVL_FREE dfree )); +tavl_free LDAP_P(( TAvlnode *root, AVL_FREE dfree )); LDAP_AVL_F( int ) -tavl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP)); +tavl_insert LDAP_P((TAvlnode **, void*, AVL_CMP, AVL_DUP)); LDAP_AVL_F( void* ) -tavl_delete LDAP_P((Avlnode **, void*, AVL_CMP)); +tavl_delete LDAP_P((TAvlnode **, void*, AVL_CMP)); LDAP_AVL_F( void* ) -tavl_find LDAP_P((Avlnode *, const void*, AVL_CMP)); +tavl_find LDAP_P((TAvlnode *, const void*, AVL_CMP)); -LDAP_AVL_F( Avlnode* ) -tavl_find2 LDAP_P((Avlnode *, const void*, AVL_CMP)); +LDAP_AVL_F( TAvlnode* ) +tavl_find2 LDAP_P((TAvlnode *, const void*, AVL_CMP)); -LDAP_AVL_F( Avlnode* ) -tavl_find3 LDAP_P((Avlnode *, const void*, AVL_CMP, int *ret)); +LDAP_AVL_F( TAvlnode* ) +tavl_find3 LDAP_P((TAvlnode *, const void*, AVL_CMP, int *ret)); #define TAVL_DIR_LEFT 0 #define TAVL_DIR_RIGHT 1 -LDAP_AVL_F( Avlnode* ) -tavl_end LDAP_P((Avlnode *, int direction )); +LDAP_AVL_F( TAvlnode* ) +tavl_end LDAP_P((TAvlnode *, int direction)); -LDAP_AVL_F( Avlnode* ) -tavl_next LDAP_P((Avlnode *, int direction )); +LDAP_AVL_F( TAvlnode* ) +tavl_next LDAP_P((TAvlnode *, int direction)); /* apply traversal types */ #define AVL_PREORDER 1