This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: better cpplex.c patch
- To: Greg McGary <greg at mcgary dot org>
- Subject: Re: PATCH: better cpplex.c patch
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 13 Sep 2000 19:46:01 -0600
- cc: zack at wolery dot cumb dot org, gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <ms4s40c4m4.fsf@mcgary.org>you write:
> Jeffrey A Law <law@cygnus.com> writes:
>
> > In message <msn1hvod19.fsf@mcgary.org>you write:
> > > > Or are we indeed resizing items within the realloc'd buffer too?
> > >
> > > Yes, we are--at least for now.
> > OK. I missed that. Sigh. How gross.
>
> Here's a patch that sets bounds on the token strings allocated from a
> token-list namebuf, and expands the bounds of only the token for which
> we're expanding the namebuf. In all other places, token text is
> allocated via single calls to malloc or strdup which return the
> properly bounded pointer. We only need special handling for these
> token list beasties because they allocate out of a single contiguous
> buffer.
>
> Zack, what's the rationale for tokenlists allocating from a single
> buffer? Does this save significant time because you can free a token
> list all at once? Is the savings still enough when you account for
> the cost of realloc'ing and relocating token pointers?
>
> 2000-09-01 Greg McGary <greg@mcgary.org>
>
> * cpplex.c (bounded-ptr.h): New include.
> (_cpp_expand_name_space): Also relocate bounds of token pointers.
> (parse_number, parse_string, save_comment): Set bounds
> of newly minted token.
Did the bounded-ptr.h patch ever get approved/installed? This patch is
fine once the patch which introduces bounded-ptr.h patch has been installed.
If the bounded-ptr.h patch hasn't been installed, could you please repost it?
Thanks,
jeff