MCPcopy Create free account
hub / github.com/git/git / clear_snapshot_buffer

Function clear_snapshot_buffer

refs/packed-backend.c:180–191  ·  view source on GitHub ↗

* If the buffer in `snapshot` is active, then either munmap the * memory and close the file, or free the memory. Then set the buffer * pointers to NULL. */

Source from the content-addressed store, hash-verified

178 * pointers to NULL.
179 */
180static void clear_snapshot_buffer(struct snapshot *snapshot)
181{
182 if (snapshot->mmapped) {
183 if (munmap(snapshot->buf, snapshot->eof - snapshot->buf))
184 die_errno("error ummapping packed-refs file %s",
185 snapshot->refs->path);
186 snapshot->mmapped = 0;
187 } else {
188 free(snapshot->buf);
189 }
190 snapshot->buf = snapshot->start = snapshot->eof = NULL;
191}
192
193/*
194 * Decrease the reference count of `*snapshot`. If it goes to zero,

Callers 4

release_snapshotFunction · 0.85
sort_snapshotFunction · 0.85
create_snapshotFunction · 0.85
packed_fsckFunction · 0.85

Calls 1

die_errnoFunction · 0.85

Tested by

no test coverage detected