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:
parent
6ce7bb4581
commit
6113c4fe63
@ -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')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user