mirror of
https://github.com/mpv-player/mpv
synced 2024-12-17 20:34:58 +00:00
bstr: use vsnprintf with a proper size of 0 instead of a 1-sized buffer
There is no need for that, use of 0 size is well defined.
This commit is contained in:
parent
c3d9243a3e
commit
2c2755992d
@ -393,10 +393,7 @@ void bstr_xappend_vasprintf(void *talloc_ctx, bstr *s, const char *fmt,
|
||||
va_copy(copy, ap);
|
||||
size_t avail = talloc_get_size(s->start) - s->len;
|
||||
char *dest = s->start ? s->start + s->len : NULL;
|
||||
char c;
|
||||
if (avail < 1)
|
||||
dest = &c;
|
||||
size = vsnprintf(dest, MPMAX(avail, 1), fmt, copy);
|
||||
size = vsnprintf(dest, avail, fmt, copy);
|
||||
va_end(copy);
|
||||
|
||||
if (size < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user