1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: fix string interpolation for autofree

This commit is contained in:
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 // TODO: better check this case
g.write('${fmt}"PRId32"') g.write('${fmt}"PRId32"')
} }
if i < node.exprs.len - 1 && !g.pref.autofree { if i < node.exprs.len - 1 {
g.write('\\000') 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); guess = vsnprintf(*refbufp + *nbytes, *memsize - *nbytes, fmt, args);
if (guess < *memsize - *nbytes) { // result did fit into buffer if (guess < *memsize - *nbytes) { // result did fit into buffer
*nbytes += guess; *nbytes += guess;
return; break;
} }
} }
// increase buffer (somewhat exponentially) // increase buffer (somewhat exponentially)