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

Function strbuf_read

strbuf.c:533–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531}
532
533ssize_t strbuf_read(struct strbuf *sb, int fd, size_t hint)
534{
535 size_t oldlen = sb->len;
536 size_t oldalloc = sb->alloc;
537
538 strbuf_grow(sb, hint ? hint : 8192);
539 for (;;) {
540 ssize_t want = sb->alloc - sb->len - 1;
541 ssize_t got = read_in_full(fd, sb->buf + sb->len, want);
542
543 if (got < 0) {
544 if (oldalloc == 0)
545 strbuf_release(sb);
546 else
547 strbuf_setlen(sb, oldlen);
548 return -1;
549 }
550 sb->len += got;
551 if (got < want)
552 break;
553 strbuf_grow(sb, 8192);
554 }
555
556 sb->buf[sb->len] = '\0';
557 return sb->len - oldlen;
558}
559
560ssize_t strbuf_read_once(struct strbuf *sb, int fd, size_t hint)
561{

Callers 15

submodule_needs_pushingFunction · 0.85
bad_to_remove_submoduleFunction · 0.85
index_pipeFunction · 0.85
rpc_serviceFunction · 0.85
fake_working_tree_commitFunction · 0.85
read_patchesFunction · 0.85
populate_from_pipeFunction · 0.85
populate_from_stdinFunction · 0.85
strbuf_read_fileFunction · 0.85
apply_single_file_filterFunction · 0.85

Calls 4

strbuf_growFunction · 0.85
read_in_fullFunction · 0.85
strbuf_releaseFunction · 0.85
strbuf_setlenFunction · 0.85

Tested by 6

pack_raw_stdinFunction · 0.68
cmd__delete_gpgsigFunction · 0.68
inherit_handle_childFunction · 0.68
sort_stdinFunction · 0.68
do_zlibFunction · 0.68
cmd__string_listFunction · 0.68