summaryrefslogtreecommitdiffstats
path: root/osdep/path.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-23 22:00:16 +0100
committerwm4 <wm4@nowhere>2016-03-23 22:00:35 +0100
commitf9084c7bcea608be641f00123257a57b9f1e4ccc (patch)
treef7005347413b13746ec65a63da562f293d259505 /osdep/path.h
parentc7f802ee45ad16d74bfae1510d395d3be36d4de2 (diff)
downloadmpv-f9084c7bcea608be641f00123257a57b9f1e4ccc.tar.bz2
mpv-f9084c7bcea608be641f00123257a57b9f1e4ccc.tar.xz
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.
Diffstat (limited to 'osdep/path.h')
0 files changed, 0 insertions, 0 deletions