mirror of
https://github.com/NixOS/nix
synced 2025-06-27 21:01:16 +02:00
StringSink pre allocate
When used with `readFile`, we have a pretty good heuristic of the file size, so `reserve` this in the `string`. This will save some allocation / copy when the string is growing.
This commit is contained in:
parent
7afcb5af98
commit
2e5be2a749
2 changed files with 8 additions and 4 deletions
|
@ -162,7 +162,7 @@ MakeError(EndOfFile, Error);
|
|||
|
||||
|
||||
/* Read a file descriptor until EOF occurs. */
|
||||
string drainFD(int fd, bool block = true);
|
||||
string drainFD(int fd, bool block = true, const size_t reserveSize=0);
|
||||
|
||||
void drainFD(int fd, Sink & sink, bool block = true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue