From: Jim Meyering Date: Thu, 23 Jan 2003 20:13:42 +0000 (+0000) Subject: [HAVE_CONFIG_H]: Include . X-Git-Tag: v4.5.5~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89beded7d0583a23343198acef704a24df844dcd;p=thirdparty%2Fcoreutils.git [HAVE_CONFIG_H]: Include . Add autoconf-recommended block of alloca-related code. Cast each use of alloca to the required type, (node**). --- diff --git a/lib/tsearch.c b/lib/tsearch.c index 12d6a49a44..82bb094740 100644 --- a/lib/tsearch.c +++ b/lib/tsearch.c @@ -84,6 +84,24 @@ In this case, A has been rotated left. This preserves the ordering of the binary tree. */ +#if HAVE_CONFIG_H +# include +#endif + +#if __GNUC__ +# define alloca __builtin_alloca +#else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + # pragma alloca +# else +char *alloca (); +# endif +# endif +#endif + #include #include #include @@ -360,7 +378,7 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar) would need to have around 250.000 nodes. */ int stacksize = 40; int sp = 0; - node **nodestack = alloca (sizeof (node *) * stacksize); + node **nodestack = (node **) alloca (sizeof (node *) * stacksize); if (rootp == NULL) return NULL; @@ -376,7 +394,7 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar) { node **newstack; stacksize += 20; - newstack = alloca (sizeof (node *) * stacksize); + newstack = (node **) alloca (sizeof (node *) * stacksize); nodestack = memcpy (newstack, nodestack, sp * sizeof (node *)); } @@ -414,7 +432,7 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar) { node **newstack; stacksize += 20; - newstack = alloca (sizeof (node *) * stacksize); + newstack = (node **) alloca (sizeof (node *) * stacksize); nodestack = memcpy (newstack, nodestack, sp * sizeof (node *)); } nodestack[sp++] = parent;