summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2014-01-22 17:00:27 (GMT)
committerJason Evans <je@fb.com>2014-01-22 17:00:27 (GMT)
commit0c4e743eaf2ab6bcfd56e002fb82f95801b9292e (patch)
tree0f4ead2f0a836d8af7d8ed76d6a91c6e220b8c24 /src
parent0dec3507c62efac909e204217bf9b6c8c59d10ac (diff)
downloadjemalloc-0c4e743eaf2ab6bcfd56e002fb82f95801b9292e.zip
jemalloc-0c4e743eaf2ab6bcfd56e002fb82f95801b9292e.tar.gz
jemalloc-0c4e743eaf2ab6bcfd56e002fb82f95801b9292e.tar.bz2
Test and fix malloc_printf("%%").
Diffstat (limited to 'src')
-rw-r--r--src/util.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/util.c b/src/util.c
index 2006255..93a19fd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -400,11 +400,6 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
unsigned char len = '?';
f++;
- if (*f == '%') {
- /* %% */
- APPEND_C(*f);
- break;
- }
/* Flags. */
while (true) {
switch (*f) {
@@ -495,6 +490,11 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
switch (*f) {
char *s;
size_t slen;
+ case '%':
+ /* %% */
+ APPEND_C(*f);
+ f++;
+ break;
case 'd': case 'i': {
intmax_t val JEMALLOC_CC_SILENCE_INIT(0);
char buf[D2S_BUFSIZE];
@@ -561,8 +561,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
APPEND_PADDED_S(s, slen, width, left_justify);
f++;
break;
- }
- default: not_reached();
+ } default: not_reached();
}
break;
} default: {