| 162 | } |
| 163 | |
| 164 | struct hashfile *hashfd_ext(const struct git_hash_algo *algop, |
| 165 | int fd, const char *name, |
| 166 | const struct hashfd_options *opts) |
| 167 | { |
| 168 | struct hashfile *f = xmalloc(sizeof(*f)); |
| 169 | f->fd = fd; |
| 170 | f->check_fd = -1; |
| 171 | f->offset = 0; |
| 172 | f->total = 0; |
| 173 | f->tp = opts->progress; |
| 174 | f->name = name; |
| 175 | f->do_crc = 0; |
| 176 | f->skip_hash = 0; |
| 177 | |
| 178 | f->algop = unsafe_hash_algo(algop); |
| 179 | f->algop->init_fn(&f->ctx); |
| 180 | |
| 181 | f->buffer_len = opts->buffer_len ? opts->buffer_len : DEFAULT_IO_BUFFER_SIZE; |
| 182 | f->buffer = xmalloc(f->buffer_len); |
| 183 | f->check_buffer = NULL; |
| 184 | |
| 185 | return f; |
| 186 | } |
| 187 | |
| 188 | struct hashfile *hashfd(const struct git_hash_algo *algop, |
| 189 | int fd, const char *name) |
no test coverage detected