21 |
# include <config.h> |
# include <config.h> |
22 |
#endif |
#endif |
23 |
|
|
24 |
|
#ifdef _LIBC |
25 |
|
#include <obstack.h> |
26 |
|
#else |
27 |
#include "obstack.h" |
#include "obstack.h" |
28 |
|
#endif |
29 |
|
|
30 |
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be |
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be |
31 |
incremented whenever callers compiled using an old obstack.h can no |
incremented whenever callers compiled using an old obstack.h can no |
286 |
/* The new chunk certainly contains no empty object yet. */ |
/* The new chunk certainly contains no empty object yet. */ |
287 |
h->maybe_empty_object = 0; |
h->maybe_empty_object = 0; |
288 |
} |
} |
289 |
|
#ifdef _LIBC |
290 |
|
libc_hidden_def (_obstack_newchunk) |
291 |
|
#endif |
292 |
|
|
293 |
/* Return nonzero if object OBJ has been allocated from obstack H. |
/* Return nonzero if object OBJ has been allocated from obstack H. |
294 |
This is here for debugging. |
This is here for debugging. |
321 |
|
|
322 |
# undef obstack_free |
# undef obstack_free |
323 |
|
|
|
/* This function has two names with identical definitions. |
|
|
This is the first one, called from non-ANSI code. */ |
|
|
|
|
|
void |
|
|
_obstack_free (struct obstack *h, void *obj) |
|
|
{ |
|
|
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ |
|
|
register struct _obstack_chunk *plp; /* point to previous chunk if any */ |
|
|
|
|
|
lp = h->chunk; |
|
|
/* We use >= because there cannot be an object at the beginning of a chunk. |
|
|
But there can be an empty object at that address |
|
|
at the end of another chunk. */ |
|
|
while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) |
|
|
{ |
|
|
plp = lp->prev; |
|
|
CALL_FREEFUN (h, lp); |
|
|
lp = plp; |
|
|
/* If we switch chunks, we can't tell whether the new current |
|
|
chunk contains an empty object, so assume that it may. */ |
|
|
h->maybe_empty_object = 1; |
|
|
} |
|
|
if (lp) |
|
|
{ |
|
|
h->object_base = h->next_free = (char *) (obj); |
|
|
h->chunk_limit = lp->limit; |
|
|
h->chunk = lp; |
|
|
} |
|
|
else if (obj != 0) |
|
|
/* obj is not in any of the chunks! */ |
|
|
abort (); |
|
|
} |
|
|
|
|
|
/* This function is used from ANSI code. */ |
|
|
|
|
324 |
void |
void |
325 |
obstack_free (struct obstack *h, void *obj) |
obstack_free (struct obstack *h, void *obj) |
326 |
{ |
{ |
350 |
/* obj is not in any of the chunks! */ |
/* obj is not in any of the chunks! */ |
351 |
abort (); |
abort (); |
352 |
} |
} |
353 |
|
|
354 |
|
#ifdef _LIBC |
355 |
|
/* Older versions of libc used a function _obstack_free intended to be |
356 |
|
called by non-GCC compilers. */ |
357 |
|
strong_alias (obstack_free, _obstack_free) |
358 |
|
#endif |
359 |
|
|
360 |
int |
int |
361 |
_obstack_memory_used (struct obstack *h) |
_obstack_memory_used (struct obstack *h) |
378 |
# endif |
# endif |
379 |
# define _(msgid) gettext (msgid) |
# define _(msgid) gettext (msgid) |
380 |
|
|
381 |
# if defined _LIBC && defined USE_IN_LIBIO |
# ifdef _LIBC |
382 |
# include <libio/iolibio.h> |
# include <libio/iolibio.h> |
|
# define fputs(s, f) _IO_fputs (s, f) |
|
383 |
# endif |
# endif |
384 |
|
|
385 |
# ifndef __attribute__ |
# ifndef __attribute__ |