aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloca.c
diff options
context:
space:
mode:
authorKenichi Handa2003-09-08 11:56:09 +0000
committerKenichi Handa2003-09-08 11:56:09 +0000
commit463f5630a5e7cbe7f042bc1175d1fa1c4e98860f (patch)
tree3287d0c628fea2249abf4635b3a4f45bedd6f8c4 /src/alloca.c
parent4256310de631bd57c78b88b5131caa073315b3d7 (diff)
downloademacs-463f5630a5e7cbe7f042bc1175d1fa1c4e98860f.tar.gz
emacs-463f5630a5e7cbe7f042bc1175d1fa1c4e98860f.zip
New directory
Diffstat (limited to 'src/alloca.c')
-rw-r--r--src/alloca.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/alloca.c b/src/alloca.c
index 460d0ae9a54..4b574374bff 100644
--- a/src/alloca.c
+++ b/src/alloca.c
@@ -36,6 +36,7 @@
36#endif 36#endif
37 37
38#ifdef DO_BLOCK_INPUT 38#ifdef DO_BLOCK_INPUT
39# include "lisp.h"
39# include "blockinput.h" 40# include "blockinput.h"
40#endif 41#endif
41 42
@@ -57,10 +58,7 @@ you
57lose 58lose
58-- must know STACK_DIRECTION at compile-time 59-- must know STACK_DIRECTION at compile-time
59/* Using #error here is not wise since this file should work for 60/* Using #error here is not wise since this file should work for
60 old and obscure compilers. 61 old and obscure compilers. */
61
62 As far as I know, using it is OK if it's indented -- at least for
63 pcc-based processors. -- fx */
64# endif /* STACK_DIRECTION undefined */ 62# endif /* STACK_DIRECTION undefined */
65# endif /* static */ 63# endif /* static */
66# endif /* emacs */ 64# endif /* emacs */
@@ -75,32 +73,38 @@ long i00afunc ();
75# define ADDRESS_FUNCTION(arg) &(arg) 73# define ADDRESS_FUNCTION(arg) &(arg)
76# endif 74# endif
77 75
78# ifndef POINTER_TYPE 76# ifdef POINTER_TYPE
79# ifdef __STDC__
80# define POINTER_TYPE void
81# else
82# define POINTER_TYPE char
83# endif
84# endif
85typedef POINTER_TYPE *pointer; 77typedef POINTER_TYPE *pointer;
78# else /* not POINTER_TYPE */
79# if __STDC__
80typedef void *pointer;
81# else /* not __STDC__ */
82typedef char *pointer;
83# endif /* not __STDC__ */
84# endif /* not POINTER_TYPE */
86 85
87# ifndef NULL 86# ifndef NULL
88# define NULL 0 87# define NULL 0
89# endif 88# endif
90 89
91/* The Emacs executable needs alloca to call xmalloc, because ordinary 90/* Different portions of Emacs need to call different versions of
92 malloc isn't protected from input signals. xmalloc also checks for 91 malloc. The Emacs executable needs alloca to call xmalloc, because
93 out-of-memory errors, so we should use it generally. 92 ordinary malloc isn't protected from input signals. On the other
93 hand, the utilities in lib-src need alloca to call malloc; some of
94 them are very simple, and don't have an xmalloc routine.
94 95
95 Callers below should use malloc. */ 96 Non-Emacs programs expect this to call xmalloc.
96 97
97# undef malloc 98 Callers below should use malloc. */
98# define malloc xmalloc
99# undef free
100# define free xfree
101 99
102void *xmalloc _P ((size_t)); 100# ifdef emacs
103void xfree _P ((void *)) 101# undef malloc
102# define malloc xmalloc
103# ifdef EMACS_FREE
104# define free EMACS_FREE
105# endif
106# endif
107extern pointer malloc ();
104 108
105/* Define STACK_DIRECTION if you know the direction of stack 109/* Define STACK_DIRECTION if you know the direction of stack
106 growth for your system; otherwise it will be automatically 110 growth for your system; otherwise it will be automatically
@@ -225,8 +229,8 @@ alloca (size)
225 /* Allocate combined header + user data storage. */ 229 /* Allocate combined header + user data storage. */
226 230
227 { 231 {
228 /* Address of header. */
229 register pointer new = malloc (sizeof (header) + size); 232 register pointer new = malloc (sizeof (header) + size);
233 /* Address of header. */
230 234
231 if (new == 0) 235 if (new == 0)
232 abort(); 236 abort();
@@ -512,6 +516,3 @@ i00afunc (long address)
512 516
513# endif /* no alloca */ 517# endif /* no alloca */
514#endif /* not GCC version 2 */ 518#endif /* not GCC version 2 */
515
516/* arch-tag: 5c9901c8-3cd4-453e-bd66-d9035a175ee3
517 (do not change this comment) */