1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 02:11:15 +02:00

withBuffer: avoid allocating a std::function

This commit is contained in:
Robert Hensing 2022-01-06 15:11:37 +01:00
parent 55c58580be
commit 6dd271b7b4
2 changed files with 5 additions and 2 deletions

View file

@ -273,7 +273,7 @@ Derivation parseDerivation(const Store & store, std::string && s, std::string_vi
static void printString(string & res, std::string_view s)
{
size_t bufSize = s.size() * 2 + 2;
withBuffer<void, char>(bufSize, [&](char buf[]) {
withBuffer(bufSize, [&](char *buf) {
char * p = buf;
*p++ = '"';
for (auto c : s)