MCPcopy Index your code
hub / github.com/git/git / fill

Function fill

builtin/unpack-objects.c:67–88  ·  view source on GitHub ↗

* Make sure at least "min" bytes are available in the buffer, and * return the pointer to the buffer. */

Source from the content-addressed store, hash-verified

65 * return the pointer to the buffer.
66 */
67static void *fill(int min)
68{
69 if (min <= len)
70 return buffer + offset;
71 if (min > sizeof(buffer))
72 die("cannot fill %d bytes", min);
73 if (offset) {
74 git_hash_update(&ctx, buffer, offset);
75 memmove(buffer, buffer + offset, len);
76 offset = 0;
77 }
78 do {
79 ssize_t ret = xread(0, buffer + len, sizeof(buffer) - len);
80 if (ret <= 0) {
81 if (!ret)
82 die("early EOF");
83 die_errno("read error on input");
84 }
85 len += ret;
86 } while (len < min);
87 return buffer;
88}
89
90static void use(int bytes)
91{

Callers 6

get_dataFunction · 0.70
feed_input_zstreamFunction · 0.70
unpack_delta_entryFunction · 0.70
unpack_oneFunction · 0.70
unpack_allFunction · 0.70
cmd_unpack_objectsFunction · 0.70

Calls 4

git_hash_updateFunction · 0.85
xreadFunction · 0.85
die_errnoFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected