mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
util: add a return value to util_sprintf
The regular sprintf is expected to return the number of char writter, so let's do the same in our version. Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20643>
This commit is contained in:
parent
fa227969a3
commit
63203f94e8
1 changed files with 3 additions and 2 deletions
|
|
@ -67,14 +67,15 @@ util_strchrnul(const char *s, char c)
|
|||
#ifdef _WIN32
|
||||
|
||||
#define sprintf util_sprintf
|
||||
static inline void
|
||||
static inline int
|
||||
PRINTFLIKE(2, 3)
|
||||
util_sprintf(char *str, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vsnprintf(str, INT_MAX, format, ap);
|
||||
int r = vsnprintf(str, INT_MAX, format, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
#define vasprintf util_vasprintf
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue