49 r = _vsnprintf(str, size, format, args);
51 r = vsnprintf(str, size, format, args);
54 if (r < 0 || r >= (ssize_t)size)
82 if (!*strp || r < 0) {
84 raw_assert_unreached_msg(
"Internal error in asprintf");
100 #ifdef HAVE_VASPRINTF
102 int r = vasprintf(&strp_tmp, fmt, args);
108 #elif defined(HAVE__VSCPRINTF)
113 va_copy(tmp_args, args);
114 len = _vscprintf(fmt, tmp_args);
120 strp_tmp = tor_malloc((
size_t)len + 1);
121 r = _vsnprintf(strp_tmp, (
size_t)len+1, fmt, args);
140 va_copy(tmp_args, args);
145 len = vsnprintf(buf,
sizeof(buf), fmt, tmp_args);
147 buf[
sizeof(buf) - 1] =
'\0';
152 if (len < (
int)
sizeof(buf)) {
153 *strp = tor_strdup(buf);
156 strp_tmp = tor_malloc((
size_t)len+1);
Headers for util_malloc.c.
int tor_vsnprintf(char *str, size_t size, const char *format, va_list args)
int tor_vasprintf(char **strp, const char *fmt, va_list args)
int tor_asprintf(char **strp, const char *fmt,...)
int tor_snprintf(char *str, size_t size, const char *format,...)
Integer definitions used throughout Tor.