Mercurial > hg > xemacs-beta
comparison src/alloca.c @ 203:850242ba4a81 r20-3b28
Import from CVS: tag r20-3b28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:02:21 +0200 |
parents | 3d6bfa290dbd |
children | de805c49cfc1 |
comparison
equal
deleted
inserted
replaced
202:61eefc8fc970 | 203:850242ba4a81 |
---|---|
191 alloca (size) | 191 alloca (size) |
192 #endif | 192 #endif |
193 unsigned size; | 193 unsigned size; |
194 { | 194 { |
195 auto char probe; /* Probes stack depth: */ | 195 auto char probe; /* Probes stack depth: */ |
196 register char *depth = ADDRESS_FUNCTION (probe); | 196 REGISTER char *depth = ADDRESS_FUNCTION (probe); |
197 | 197 |
198 #if STACK_DIRECTION == 0 | 198 #if STACK_DIRECTION == 0 |
199 if (STACK_DIR == 0) /* Unknown growth direction. */ | 199 if (STACK_DIR == 0) /* Unknown growth direction. */ |
200 find_stack_direction (); | 200 find_stack_direction (); |
201 #endif | 201 #endif |
202 | 202 |
203 /* Reclaim garbage, defined as all alloca'd storage that | 203 /* Reclaim garbage, defined as all alloca'd storage that |
204 was allocated from deeper in the stack than currently. */ | 204 was allocated from deeper in the stack than currently. */ |
205 | 205 |
206 { | 206 { |
207 register header *hp; /* Traverses linked list. */ | 207 REGISTER header *hp; /* Traverses linked list. */ |
208 | 208 |
209 for (hp = last_alloca_header; hp != NULL;) | 209 for (hp = last_alloca_header; hp != NULL;) |
210 if ((STACK_DIR > 0 && hp->h.deep > depth) | 210 if ((STACK_DIR > 0 && hp->h.deep > depth) |
211 || (STACK_DIR < 0 && hp->h.deep < depth)) | 211 || (STACK_DIR < 0 && hp->h.deep < depth)) |
212 { | 212 { |
213 register header *np = hp->h.next; | 213 REGISTER header *np = hp->h.next; |
214 | 214 |
215 free ((pointer) hp); /* Collect garbage. */ | 215 free ((pointer) hp); /* Collect garbage. */ |
216 | 216 |
217 hp = np; /* -> next header. */ | 217 hp = np; /* -> next header. */ |
218 } | 218 } |
226 return NULL; /* No allocation required. */ | 226 return NULL; /* No allocation required. */ |
227 | 227 |
228 /* Allocate combined header + user data storage. */ | 228 /* Allocate combined header + user data storage. */ |
229 | 229 |
230 { | 230 { |
231 register pointer new = malloc (sizeof (header) + size); | 231 REGISTER pointer new = malloc (sizeof (header) + size); |
232 /* Address of header. */ | 232 /* Address of header. */ |
233 | 233 |
234 ((header *) new)->h.next = last_alloca_header; | 234 ((header *) new)->h.next = last_alloca_header; |
235 ((header *) new)->h.deep = depth; | 235 ((header *) new)->h.deep = depth; |
236 | 236 |