From ff08c4194c8795758b949acf3086c1b2f4ef3afb Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 30 Jan 2009 14:14:22 +0000 Subject: [PATCH] Cleanup - macroize magic constant (ITS#5909) --- libraries/liblutil/avl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/liblutil/avl.c b/libraries/liblutil/avl.c index 6665307a36..ef62a6ff57 100644 --- a/libraries/liblutil/avl.c +++ b/libraries/liblutil/avl.c @@ -34,6 +34,7 @@ #include "portable.h" +#include #include #include @@ -48,6 +49,9 @@ #define AVL_INTERNAL #include "avl.h" +/* Maximum tree depth this host's address space could support */ +#define MAX_TREE_DEPTH (sizeof(void *) * CHAR_BIT) + static const int avl_bfs[] = {LH, RH}; /* @@ -180,8 +184,8 @@ avl_delete( Avlnode **root, void* data, AVL_CMP fcmp ) int side, side_bf, shorter, nside; /* parent stack */ - Avlnode *pptr[sizeof(void *)*8]; - unsigned char pdir[sizeof(void *)*8]; + Avlnode *pptr[MAX_TREE_DEPTH]; + unsigned char pdir[MAX_TREE_DEPTH]; int depth = 0; if ( *root == NULL ) -- 2.39.5