X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fobstack.c;h=7c71acdeaf7bed266c0d3a3aee3cb7459f6f72bd;hb=55898ee1c7c12e63772c65e772577f10bb7adb31;hp=5b87466d881f1df66874890eff3212a444f8700f;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/obstack.c b/lib/obstack.c index 5b87466d8..7c71acdea 100644 --- a/lib/obstack.c +++ b/lib/obstack.c @@ -1,7 +1,7 @@ /* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -39,7 +39,7 @@ program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ -#include /* Random thing to get __GNU_LIBRARY__. */ +#include /* Random thing to get __GNU_LIBRARY__. */ #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 # include # if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION @@ -141,9 +141,9 @@ compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); int _obstack_begin (struct obstack *h, - int size, int alignment, - void *(*chunkfun) (long), - void (*freefun) (void *)) + int size, int alignment, + void *(*chunkfun) (long), + void (*freefun) (void *)) { register struct _obstack_chunk *chunk; /* points to new chunk */ @@ -153,16 +153,16 @@ _obstack_begin (struct obstack *h, /* Default size is what GNU malloc can fit in a 4096-byte block. */ { /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); size = 4096 - extra; } @@ -176,7 +176,7 @@ _obstack_begin (struct obstack *h, if (!chunk) (*obstack_alloc_failed_handler) (); h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, - alignment - 1); + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -188,9 +188,9 @@ _obstack_begin (struct obstack *h, int _obstack_begin_1 (struct obstack *h, int size, int alignment, - void *(*chunkfun) (void *, long), - void (*freefun) (void *, void *), - void *arg) + void *(*chunkfun) (void *, long), + void (*freefun) (void *, void *), + void *arg) { register struct _obstack_chunk *chunk; /* points to new chunk */ @@ -200,16 +200,16 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment, /* Default size is what GNU malloc can fit in a 4096-byte block. */ { /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); size = 4096 - extra; } @@ -224,7 +224,7 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment, if (!chunk) (*obstack_alloc_failed_handler) (); h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, - alignment - 1); + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -245,7 +245,7 @@ _obstack_newchunk (struct obstack *h, int length) { register struct _obstack_chunk *old_chunk = h->chunk; register struct _obstack_chunk *new_chunk; - register long new_size; + register long new_size; register long obj_size = h->next_free - h->object_base; register long i; long already; @@ -274,12 +274,12 @@ _obstack_newchunk (struct obstack *h, int length) if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) { for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *)object_base)[i] - = ((COPYING_UNIT *)h->object_base)[i]; + i >= 0; i--) + ((COPYING_UNIT *)object_base)[i] + = ((COPYING_UNIT *)h->object_base)[i]; /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, - but that can cross a page boundary on a machine - which does not do strict alignment for COPYING_UNITS. */ + but that can cross a page boundary on a machine + which does not do strict alignment for COPYING_UNITS. */ already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); } else @@ -293,8 +293,8 @@ _obstack_newchunk (struct obstack *h, int length) But not if that chunk might contain an empty object. */ if (! h->maybe_empty_object && (h->object_base - == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, - h->alignment_mask))) + == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, + h->alignment_mask))) { new_chunk->prev = old_chunk->prev; CALL_FREEFUN (h, old_chunk); @@ -320,8 +320,8 @@ int _obstack_allocated_p (struct obstack *h, void *obj); int _obstack_allocated_p (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 */ + 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 >= rather than > since the object cannot be exactly at @@ -343,8 +343,8 @@ _obstack_allocated_p (struct obstack *h, void *obj) 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 */ + 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. @@ -356,7 +356,7 @@ __obstack_free (struct obstack *h, void *obj) 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. */ + chunk contains an empty object, so assume that it may. */ h->maybe_empty_object = 1; } if (lp) @@ -427,4 +427,4 @@ print_and_abort (void) exit (obstack_exit_failure); } -#endif /* !ELIDE_CODE */ +#endif /* !ELIDE_CODE */