projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New module 'dummy'.
[gnulib.git]
/
lib
/
alloca.c
diff --git
a/lib/alloca.c
b/lib/alloca.c
index
5e2521b
..
d1d5447
100644
(file)
--- a/
lib/alloca.c
+++ b/
lib/alloca.c
@@
-25,19
+25,20
@@
# include <config.h>
#endif
# include <config.h>
#endif
+#include <alloca.h>
+
#include <string.h>
#include <stdlib.h>
#ifdef emacs
# include "lisp.h"
# include "blockinput.h"
#include <string.h>
#include <stdlib.h>
#ifdef emacs
# include "lisp.h"
# include "blockinput.h"
-# define xalloc_die() memory_full ()
# ifdef EMACS_FREE
# undef free
# define free EMACS_FREE
# endif
#else
# ifdef EMACS_FREE
# undef free
# define free EMACS_FREE
# endif
#else
-#
include <xalloc.h>
+#
define memory_full() abort ()
#endif
/* If compiling with GCC 2, this file's not needed. */
#endif
/* If compiling with GCC 2, this file's not needed. */
@@
-196,22
+197,25
@@
alloca (size_t size)
{
/* Address of header. */
{
/* Address of header. */
- register
void
*new;
+ register
header
*new;
size_t combined_size = sizeof (header) + size;
if (combined_size < sizeof (header))
size_t combined_size = sizeof (header) + size;
if (combined_size < sizeof (header))
- xalloc_die ();
+ memory_full ();
+
+ new = malloc (combined_size);
- new = xmalloc (combined_size);
+ if (! new)
+ memory_full ();
-
((header *) new)
->h.next = last_alloca_header;
-
((header *) new)
->h.deep = depth;
+
new
->h.next = last_alloca_header;
+
new
->h.deep = depth;
- last_alloca_header =
(header *)
new;
+ last_alloca_header = new;
/* User storage begins just after header. */
/* User storage begins just after header. */
- return (void *) (
(char *) new + sizeof (header)
);
+ return (void *) (
new + 1
);
}
}
}
}