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

Function read_patch_file

apply.c:402–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400#define MAX_APPLY_SIZE (1024UL * 1024 * 1023)
401
402static int read_patch_file(struct strbuf *sb, int fd)
403{
404 if (strbuf_read(sb, fd, 0) < 0)
405 return error_errno(_("failed to read patch"));
406 else if (sb->len >= MAX_APPLY_SIZE)
407 return error(_("patch too large"));
408 /*
409 * Make sure that we have some slop in the buffer
410 * so that we can do speculative "memcmp" etc, and
411 * see to it that it is NUL-filled.
412 */
413 strbuf_grow(sb, SLOP);
414 memset(sb->buf + sb->len, 0, SLOP);
415 return 0;
416}
417
418static unsigned long linelen(const char *buffer, unsigned long size)
419{

Callers 1

apply_patchFunction · 0.85

Calls 4

strbuf_readFunction · 0.85
error_errnoFunction · 0.85
errorFunction · 0.85
strbuf_growFunction · 0.85

Tested by

no test coverage detected