Add autoconf-recommended block of alloca-related code.
authorJim Meyering <jim@meyering.net>
Thu, 23 Jan 2003 20:12:08 +0000 (20:12 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 23 Jan 2003 20:12:08 +0000 (20:12 +0000)
[!_LIBC] (__getcwd): Define to xgetcwd and declare xgetcwd.

lib/ftw.c

index 78daf8a..ef1e2a9 100644 (file)
--- a/lib/ftw.c
+++ b/lib/ftw.c
 # include <config.h>
 #endif
 
+#if __GNUC__
+# define alloca __builtin_alloca
+#else
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #  pragma alloca
+#  else
+char *alloca ();
+#  endif
+# endif
+#endif
+
 #if defined _LIBC
 # include <dirent.h>
 # define NAMLEN(dirent) _D_EXACT_NAMLEN(dirent)
@@ -78,8 +92,6 @@ char *stpcpy ();
 # define __closedir closedir
 # undef __fchdir
 # define __fchdir fchdir
-# undef __getcwd
-# define __getcwd getcwd
 # undef __opendir
 # define __opendir opendir
 # undef __readdir64
@@ -102,6 +114,12 @@ char *stpcpy ();
 # define MAX(a, b) ((a) > (b) ? (a) : (b))
 #endif
 
+#ifndef _LIBC
+# undef __getcwd
+# define __getcwd(P, N) xgetcwd ()
+extern char *xgetcwd (void);
+#endif
+
 #ifndef __set_errno
 # define __set_errno(Val) errno = (Val)
 #endif