summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-09-10 08:27:32 +0000
committerJim Meyering <jim@meyering.net>2003-09-10 08:27:32 +0000
commita76d1c83c1daf675e818d54dd9c3f5a298515f52 (patch)
tree014d690fd38347c837ed394248940cae4910802d
parent0d84cc66ee79ccd92f4c30548ceaa632dd7d3144 (diff)
downloadcoreutils-a76d1c83c1daf675e818d54dd9c3f5a298515f52.tar.xz
Include <string.h>, <stdlib.h> unconditionally.
(POINTER_TYPE, pointer): Remove; all uses changed to void *. (NULL): Remove. (find_stack_direction, alloca): Use prototypes.
-rw-r--r--lib/alloca.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/lib/alloca.c b/lib/alloca.c
index f4c364a72..c4db187da 100644
--- a/lib/alloca.c
+++ b/lib/alloca.c
@@ -25,12 +25,8 @@
# include <config.h>
#endif
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#include <string.h>
+#include <stdlib.h>
#ifdef emacs
# include "lisp.h"
@@ -77,19 +73,6 @@ long i00afunc ();
# define ADDRESS_FUNCTION(arg) &(arg)
# endif
-# ifndef POINTER_TYPE
-# ifdef __STDC__
-# define POINTER_TYPE void
-# else
-# define POINTER_TYPE char
-# endif
-# endif
-typedef POINTER_TYPE *pointer;
-
-# ifndef NULL
-# define NULL 0
-# endif
-
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
@@ -112,7 +95,7 @@ static int stack_dir; /* 1 or -1 once known. */
# define STACK_DIR stack_dir
static void
-find_stack_direction ()
+find_stack_direction (void)
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
@@ -165,9 +148,8 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
-pointer
-alloca (size)
- size_t size;
+void *
+alloca (size_t size)
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
@@ -214,7 +196,7 @@ alloca (size)
{
/* Address of header. */
- register pointer new;
+ register void *new;
size_t combined_size = sizeof (header) + size;
if (combined_size < sizeof (header))
@@ -232,7 +214,7 @@ alloca (size)
/* User storage begins just after header. */
- return (pointer) ((char *) new + sizeof (header));
+ return (void *) ((char *) new + sizeof (header));
}
}