This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Allocate sufficient space for string buffer
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 8 Jun 2012 11:39:07 +0930
- Subject: Re: PATCH: Allocate sufficient space for string buffer
- References: <20120607185845.GA24095@intel.com>
On Thu, Jun 07, 2012 at 11:58:45AM -0700, H.J. Lu wrote:
> * input-scrub.c (input_scrub_include_sb): Use sb_build to
> allocate sufficient space for from_sb.
> * read.c (do_repeat): Use sb_build to allocate sufficient space
> for many.
> * sb.c (sb_build): Remove static.
> * sb.h (sb_build): New prototype.
Seems a reasonable optimisation. OK, but
> - sb_new (&many);
> + sb_build (&many, count * one.len + 1);
looks wrong to me. sb_build already adds one to account for the
string terminator.
--
Alan Modra
Australia Development Lab, IBM