]> git.ipfire.org Git - thirdparty/elfutils.git/commit
readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.
authorMark Wielaard <mark@klomp.org>
Sat, 2 Jun 2018 02:24:01 +0000 (04:24 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 4 Jun 2018 17:03:18 +0000 (19:03 +0200)
commit608146eab9852cf2c9f077d0532688c13eb251a4
tree5755c5ded94d20ee89ce9405798c10aaa7b04b06
parentbb5599d8085eb4bb186b711a8c16cea4334c70b4
readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.

Since we are single threaded we can just use a static result buffer for
format_dwarf_addr as long as we make sure to print the result before
calling format_dwarf_addr again. This removes lots of malloc/free calls.

On my machine eu-readelf -N --debug-dump=info libxul.so
goes from 57 seconds to 55 seconds.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/readelf.c