Fix -Wunreachable-code warning in malloc_vsnprintf().

Variables s and slen are declared inside a switch statement, but outside
a case scope. clang reports these variable definitions as "unreachable",
though this is not really meaningful in this case. This is the only
-Wunreachable-code warning in jemalloc.

src/util.c:501:5 [-Wunreachable-code] code will never be executed

This resolves #364.
This commit is contained in:
Chris Peterson 2016-03-26 01:19:28 -07:00 committed by Jason Evans
parent f3060284c5
commit 0bc716ae27

View File

@ -408,6 +408,8 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
int prec = -1; int prec = -1;
int width = -1; int width = -1;
unsigned char len = '?'; unsigned char len = '?';
char *s;
size_t slen;
f++; f++;
/* Flags. */ /* Flags. */
@ -498,8 +500,6 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
} }
/* Conversion specifier. */ /* Conversion specifier. */
switch (*f) { switch (*f) {
char *s;
size_t slen;
case '%': case '%':
/* %% */ /* %% */
APPEND_C(*f); APPEND_C(*f);