builtin: fix string interpolation for autofree

pull/5373/head
Uwe Krüger 2020-06-13 18:39:17 +02:00 committed by GitHub
parent 6ce7bb4581
commit 6113c4fe63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -3054,7 +3054,7 @@ fn (mut g Gen) string_inter_literal(node ast.StringInterLiteral) {
// TODO: better check this case
g.write('${fmt}"PRId32"')
}
if i < node.exprs.len - 1 && !g.pref.autofree {
if i < node.exprs.len - 1 {
g.write('\\000')
}
}

View File

@ -18,7 +18,7 @@ void _STR_PRINT_ARG(const char *fmt, char** refbufp, int *nbytes, int *memsize,
guess = vsnprintf(*refbufp + *nbytes, *memsize - *nbytes, fmt, args);
if (guess < *memsize - *nbytes) { // result did fit into buffer
*nbytes += guess;
return;
break;
}
}
// increase buffer (somewhat exponentially)