[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: obstack usage question
From: |
Paul Eggert |
Subject: |
Re: obstack usage question |
Date: |
Tue, 10 Oct 2006 14:45:30 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Eric Blake <address@hidden> writes:
> Is the name okay? Is it worth adding to gnulib?
Ideally I suppose it'd be added to glibc as well. This means patching
the documentation, adding implementations for non-GCC compilers, etc.
The name is fine with me.
The style should use the same style as the current obstack.h;
see its obstack_grow macro.
> void *__end = (void *)((PTR_INT_TYPE)(OBJ) + (SIZE)); \
This does not look right to me. PTR_INT_TYPE is not necessarily wide
enough to hold a pointer. Look for "AS/400" in obstack.h.
> 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; \
> } \
How about this instead? It's a bit simpler.
obstack_free (__o, __end);
__o->object_base = (char *)__obj;