mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
* Some refactoring: put the GC options / results in separate structs.
* The garbage collector now also prints the number of blocks freed.
This commit is contained in:
parent
934c58aa38
commit
a72709afd8
15 changed files with 252 additions and 166 deletions
|
@ -41,6 +41,21 @@ void writeInt(unsigned int n, Sink & sink)
|
|||
}
|
||||
|
||||
|
||||
void writeLongLong(unsigned long long n, Sink & sink)
|
||||
{
|
||||
unsigned char buf[8];
|
||||
buf[0] = n & 0xff;
|
||||
buf[1] = (n >> 8) & 0xff;
|
||||
buf[2] = (n >> 16) & 0xff;
|
||||
buf[3] = (n >> 24) & 0xff;
|
||||
buf[4] = (n >> 32) & 0xff;
|
||||
buf[5] = (n >> 40) & 0xff;
|
||||
buf[6] = (n >> 48) & 0xff;
|
||||
buf[7] = (n >> 56) & 0xff;
|
||||
sink(buf, sizeof(buf));
|
||||
}
|
||||
|
||||
|
||||
void writeString(const string & s, Sink & sink)
|
||||
{
|
||||
unsigned int len = s.length();
|
||||
|
@ -84,6 +99,22 @@ unsigned int readInt(Source & source)
|
|||
}
|
||||
|
||||
|
||||
unsigned long long readLongLong(Source & source)
|
||||
{
|
||||
unsigned char buf[8];
|
||||
source(buf, sizeof(buf));
|
||||
return
|
||||
((unsigned long long) buf[0]) |
|
||||
((unsigned long long) buf[1] << 8) |
|
||||
((unsigned long long) buf[2] << 16) |
|
||||
((unsigned long long) buf[3] << 24) |
|
||||
((unsigned long long) buf[4] << 32) |
|
||||
((unsigned long long) buf[5] << 40) |
|
||||
((unsigned long long) buf[6] << 48) |
|
||||
((unsigned long long) buf[7] << 56);
|
||||
}
|
||||
|
||||
|
||||
string readString(Source & source)
|
||||
{
|
||||
unsigned int len = readInt(source);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue