diff options
| author | Jason Evans <jasone@canonware.com> | 2016-05-12 21:51:07 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2016-05-12 21:53:25 (GMT) |
| commit | f70a254d44c8d30af2cd5d30531fb18fdabaae6d (patch) | |
| tree | 4e226a1bd0d56d742ca0950f69829ed7f0216e62 /src/util.c | |
| parent | e02b83cc5e3c4d30f93dba945162e3aa58d962d6 (diff) | |
| parent | 09f8585ce8a57baa387cc0327e51c0baffbdce6f (diff) | |
| download | jemalloc-4.2.0.zip jemalloc-4.2.0.tar.gz jemalloc-4.2.0.tar.bz2 | |
Merge branch 'dev'4.2.0
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -14,6 +14,7 @@ malloc_write("<jemalloc>: Unreachable code reached\n"); \ abort(); \ } \ + unreachable(); \ } while (0) #define not_implemented() do { \ @@ -314,10 +315,9 @@ x2s(uintmax_t x, bool alt_form, bool uppercase, char *s, size_t *slen_p) return (s); } -int +size_t malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) { - int ret; size_t i; const char *f; @@ -408,6 +408,8 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) int prec = -1; int width = -1; unsigned char len = '?'; + char *s; + size_t slen; f++; /* Flags. */ @@ -498,8 +500,6 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) } /* Conversion specifier. */ switch (*f) { - char *s; - size_t slen; case '%': /* %% */ APPEND_C(*f); @@ -585,21 +585,19 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) str[i] = '\0'; else str[size - 1] = '\0'; - assert(i < INT_MAX); - ret = (int)i; #undef APPEND_C #undef APPEND_S #undef APPEND_PADDED_S #undef GET_ARG_NUMERIC - return (ret); + return (i); } JEMALLOC_FORMAT_PRINTF(3, 4) -int +size_t malloc_snprintf(char *str, size_t size, const char *format, ...) { - int ret; + size_t ret; va_list ap; va_start(ap, format); |
