objdump:avoid some copying
Nathan Sidwell
nathan@codesourcery.com
Thu Mar 4 16:53:00 GMT 2004
Hi,
Whilst backporting a patch to fix buffer overrun, I notice that
objdump_sprintf does unnecessary copying, and doesn't remember any sizes
from one line to the next. This patch fixes that.
The common case is that there will be enough space in the buffer, and
in that case vsnprintf will write directly there. When there is insufficient
space, we extend the buffer by at least the amount vsnprintf told us it'd
need, and then print again.
Keeping the buffer live throughtout disassemble_data means we don't keep
rediscovering our buffer is not long enough.
tested on i686-pc-linux-gnu, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: print.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20040304/e29fad98/attachment.ksh>
More information about the Binutils
mailing list