| 109 | } |
| 110 | |
| 111 | int read_lines(const char *filename, char ***namesp) |
| 112 | { |
| 113 | int fd = open(filename, O_RDONLY); |
| 114 | int err = 0; |
| 115 | if (fd < 0) { |
| 116 | if (errno == ENOENT) { |
| 117 | REFTABLE_CALLOC_ARRAY(*namesp, 1); |
| 118 | if (!*namesp) |
| 119 | return REFTABLE_OUT_OF_MEMORY_ERROR; |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | return REFTABLE_IO_ERROR; |
| 124 | } |
| 125 | err = fd_read_lines(fd, namesp); |
| 126 | close(fd); |
| 127 | return err; |
| 128 | } |
| 129 | |
| 130 | int reftable_stack_init_ref_iterator(struct reftable_stack *st, |
| 131 | struct reftable_iterator *it) |