X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fobstack.h;h=95dd438ff7072b01a2cf5647f17a83b77a6d8fdd;hb=5912e24cb503d5238ab9180b98f0215e871a6abc;hp=8170bf2a63866e5fcee084bd2a3ffe7a51668491;hpb=e868156834d09d1a0b2046c3defac1691fcfd953;p=gnulib.git diff --git a/lib/obstack.h b/lib/obstack.h index 8170bf2a6..95dd438ff 100644 --- a/lib/obstack.h +++ b/lib/obstack.h @@ -1,11 +1,7 @@ /* obstack.h - object stack macros - Copyright (C) 1988-1994,1996-1999,2003,2004 Free Software Foundation, Inc. - - This file is part of the GNU C Library. Its master source is NOT part of - the C library, however. The master source lives in /gd/gnu/lib. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.org. + Copyright (C) 1988-1994,1996-1999,2003,2004,2005 + Free Software Foundation, Inc. + This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Summary: @@ -183,52 +179,16 @@ struct obstack /* control current object in current chunk */ /* Declare the external functions we use; they are in obstack.c. */ extern void _obstack_newchunk (struct obstack *, int); -extern void _obstack_free (struct obstack *, void *); extern int _obstack_begin (struct obstack *, int, int, void *(*) (long), void (*) (void *)); extern int _obstack_begin_1 (struct obstack *, int, int, void *(*) (void *, long), void (*) (void *, void *), void *); extern int _obstack_memory_used (struct obstack *); - -/* Do the function-declarations after the structs - but before defining the macros. */ - -void obstack_init (struct obstack *obstack); - -void * obstack_alloc (struct obstack *obstack, int size); - -void * obstack_copy (struct obstack *obstack, const void *address, int size); -void * obstack_copy0 (struct obstack *obstack, const void *address, int size); void obstack_free (struct obstack *obstack, void *block); -void obstack_blank (struct obstack *obstack, int size); - -void obstack_grow (struct obstack *obstack, const void *data, int size); -void obstack_grow0 (struct obstack *obstack, const void *data, int size); - -void obstack_1grow (struct obstack *obstack, int data_char); -void obstack_ptr_grow (struct obstack *obstack, const void *data); -void obstack_int_grow (struct obstack *obstack, int data); - -void * obstack_finish (struct obstack *obstack); - -int obstack_object_size (struct obstack *obstack); - -int obstack_room (struct obstack *obstack); -void obstack_make_room (struct obstack *obstack, int size); -void obstack_1grow_fast (struct obstack *obstack, int data_char); -void obstack_ptr_grow_fast (struct obstack *obstack, const void *data); -void obstack_int_grow_fast (struct obstack *obstack, int data); -void obstack_blank_fast (struct obstack *obstack, int size); - -void * obstack_base (struct obstack *obstack); -void * obstack_next_free (struct obstack *obstack); -int obstack_alignment_mask (struct obstack *obstack); -int obstack_chunk_size (struct obstack *obstack); -int obstack_memory_used (struct obstack *obstack); - + /* Error handler called when `obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't @@ -242,7 +202,7 @@ extern int obstack_exit_failure; Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ -#define obstack_base(h) ((h)->object_base) +#define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ @@ -323,7 +283,10 @@ __extension__ \ # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ - (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); }) + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) # define obstack_grow(OBSTACK,where,length) \ __extension__ \ @@ -447,7 +410,10 @@ __extension__ \ (unsigned) ((h)->chunk_limit - (h)->next_free) # define obstack_empty_p(h) \ - ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0) + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions @@ -494,7 +460,7 @@ __extension__ \ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) # define obstack_int_grow_fast(h,aint) \ - (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr)) + (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) # define obstack_blank(h,length) \ ( (h)->temp.tempint = (length), \