From 47617b033c82d9fc07b1302aef101a5ea545bd5e Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Wed, 21 Oct 2009 11:31:59 +0000 Subject: [PATCH] Cleanup - macroize magic constant (ITS#5909) --- libraries/liblutil/tavl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/liblutil/tavl.c b/libraries/liblutil/tavl.c index 519b169911..a6a2bf4a5f 100644 --- a/libraries/liblutil/tavl.c +++ b/libraries/liblutil/tavl.c @@ -21,6 +21,7 @@ #include "portable.h" +#include #include #include @@ -35,6 +36,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}; /* @@ -189,8 +193,8 @@ tavl_delete( Avlnode **root, void* data, AVL_CMP fcmp ) int side, side_bf, shorter, nside = -1; /* 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