-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Paul Eggert on 10/9/2006 5:35 PM:
> Eric Blake <[EMAIL PROTECTED]> writes:
>
>> that double copy is bothering me; I would really like to reopen a
>> finished object for further growth without having to use temporary
>> storage. Any thoughts on the matter? Is this worth taking up with
>> glibc?
>
> Might be. How much would it change/slow down the existing code to
> add a new interface to do what you want?
>
After looking further at the obstack source code, I see no speed impact to
existing uses of obstacks, and only the code growth for the function
counterpart of this, which I think does the trick. Is the name okay? Is
it worth adding to gnulib?
/* Reopen OBJ--previously created by obstack_alloc or obstack_finish, and
currently occupying SIZE bytes--for additional growth, freeing any objects
that appeared later on the stack. SIZE may be smaller than the original
allocated size of OBJ. */
#define obstack_regrow(OBSTACK, OBJ, SIZE) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
void *__obj = (OBJ); \
void *__end = (void *)((PTR_INT_TYPE)(OBJ) + (SIZE)); \
if (__obj > (void *)__o->chunk && __end < (void *)__o->chunk_limit) \
{ \
__o->next_free = (char *)__end; \
__o->object_base = (char *)__obj; \
} \
else \
{ \
(obstack_free) (__o, __end); \
__o->object_base = (char *)__obj; \
} \
})
- --
Life is short - so eat dessert first!
Eric Blake [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFK51y84KuGfSFAYARAm6rAKCSyxFBZHWyYzyM4DEMgjq3jv2OgQCdFrD2
0nSFzcsAD2MLvNvbSudoR5k=
=VaGb
-----END PGP SIGNATURE-----