openocd/src/helper
Andreas Fritiofson 338a674faa improve alloc_vprintf
The previous implementation was unnecessarily complex. Get rid of the loops,
let vsnprintf() tell us directly how much storage we need and allocate that. A
second pass writes the actual string. Also add a va_end() that was missing.
This should be much faster for large strings and less wasteful for small ones.

A quirk that has been retained is that some callers patch in a newline at the
end of the returned string and depend on alloc_vprintf to allocate at least
one byte extra.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-24 12:48:02 -08:00
..
bin2char.c bin2char: for win32 set stdin/stdout to binary mode 2009-10-30 11:59:57 +00:00
binarybuffer.c rename CEIL as DIV_ROUND_UP 2009-11-16 09:58:11 -08:00
binarybuffer.h binarybuffer: regression fix 2009-11-16 14:50:07 -08:00
command.c maintain command lists in sorted order 2009-11-20 15:03:41 -08:00
command.h improve 'help' command 2009-11-20 14:52:56 -08:00
configuration.c embedded: reduce stack usage 2009-11-22 13:38:42 +01:00
configuration.h improve constness of open_file_from_path 2009-11-16 15:47:08 -08:00
fileio.c fileio: improve API types 2009-11-16 15:47:09 -08:00
fileio.h fileio: improve API types 2009-11-16 15:47:09 -08:00
ioutil.c command_handler: change 'cmd_ctx' to CMD_CTX 2009-11-17 11:40:06 -08:00
jim-eventloop.c Sync with official Jim Tcl repository. 2009-10-19 15:16:42 +02:00
jim-eventloop.h Andreas Fritiofson <andreas.fritiofson@gmail.com> UTF8 fixes 2009-07-17 19:54:25 +00:00
jim.c Sync with official Jim Tcl repository. 2009-10-19 15:16:42 +02:00
jim.h Sync with official Jim Tcl repository. 2009-10-19 15:16:42 +02:00
log.c improve alloc_vprintf 2009-11-24 12:48:02 -08:00
log.h helper/log: improve API parameter types 2009-11-16 15:47:09 -08:00
Makefile.am split startup.tcl file across modules 2009-11-18 07:21:42 -08:00
membuf.c Switch to strotk() grr.... 2009-06-27 16:44:35 +00:00
membuf.h Add missing copyright header and fix @page direction in membuf.h. 2009-07-01 19:55:39 +00:00
options.c support for scripts in $HOME/.openocd 2009-11-24 08:57:02 +01:00
replacements.c safer conversion to HANDLER on MinGW-W64 2009-10-17 22:18:38 -07:00
replacements.h src/helper: wrap and clean headers. 2009-11-09 09:44:33 -08:00
startup.tcl add add_help_text command handler 2009-11-20 15:03:35 -08:00
system.h remove hacks no longer required to build OpenOCD w/eCos 2009-06-05 06:43:09 +00:00
time_support.c time_support: improve use of types 2009-11-11 05:40:48 -08:00
time_support.h time_support: improve use of types 2009-11-11 05:40:48 -08:00
types.h "types.h" doxygen fix 2009-11-16 10:42:01 -08:00