mpv/misc
wm4 f9084c7bce bstr: avoid redundant vsnprintf calls
Until now, bstr_xappend_vasprintf() called vsnprintf() always twice:
once to determine how much output the call would produce, and a second
time to actually output the data to the (possibly resized) target
memory.

Change this so that it tries to output to the already allocated memory
first, and repeat the call only if allocation is required.

This is especially helpful, as bstr_xappend_vasprintf() is designed to
avoid reallocation when building strings. Usually, the second
vsnprintf() will happen only at the beginning, when the buffer hasn't
been extended to his largest needed size yet.

Not sure if there is a need to optimize this; but see the next commit.
2016-03-23 22:00:35 +01:00
..
bstr.c bstr: avoid redundant vsnprintf calls 2016-03-23 22:00:35 +01:00
bstr.h mpv_talloc.h: rename from talloc.h 2016-01-11 21:05:55 +01:00
charset_conv.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
charset_conv.h sub: detect charset in demuxer 2015-12-17 01:17:23 +01:00
ctype.h Audit and replace all ctype.h uses 2014-07-01 23:11:08 +02:00
dispatch.c dispatch: clarify lifetime issues 2016-02-26 23:28:02 +01:00
dispatch.h
json.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
json.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
rendezvous.c Add Plan 9-style barriers 2014-07-26 20:29:48 +02:00
rendezvous.h Add Plan 9-style barriers 2014-07-26 20:29:48 +02:00
ring.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
ring.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00