@@ -35,7 +35,7 @@ static int close_istream_filtered(struct odb_read_stream *_fs)
3535{
3636 struct odb_filtered_read_stream * fs = (struct odb_filtered_read_stream * )_fs ;
3737 free_stream_filter (fs -> filter );
38- return close_istream (fs -> upstream );
38+ return odb_read_stream_close (fs -> upstream );
3939}
4040
4141static ssize_t read_istream_filtered (struct odb_read_stream * _fs , char * buf ,
@@ -87,7 +87,7 @@ static ssize_t read_istream_filtered(struct odb_read_stream *_fs, char *buf,
8787
8888 /* refill the input from the upstream */
8989 if (!fs -> input_finished ) {
90- fs -> i_end = read_istream (fs -> upstream , fs -> ibuf , FILTER_BUFFER );
90+ fs -> i_end = odb_read_stream_read (fs -> upstream , fs -> ibuf , FILTER_BUFFER );
9191 if (fs -> i_end < 0 )
9292 return -1 ;
9393 if (fs -> i_end )
@@ -149,7 +149,7 @@ static ssize_t read_istream_incore(struct odb_read_stream *_st, char *buf, size_
149149}
150150
151151static int open_istream_incore (struct odb_read_stream * * out ,
152- struct repository * r ,
152+ struct object_database * odb ,
153153 const struct object_id * oid )
154154{
155155 struct object_info oi = OBJECT_INFO_INIT ;
@@ -163,7 +163,7 @@ static int open_istream_incore(struct odb_read_stream **out,
163163 oi .typep = & stream .base .type ;
164164 oi .sizep = & stream .base .size ;
165165 oi .contentp = (void * * )& stream .buf ;
166- ret = odb_read_object_info_extended (r -> objects , oid , & oi ,
166+ ret = odb_read_object_info_extended (odb , oid , & oi ,
167167 OBJECT_INFO_DIE_IF_CORRUPT );
168168 if (ret )
169169 return ret ;
@@ -180,57 +180,57 @@ static int open_istream_incore(struct odb_read_stream **out,
180180 *****************************************************************************/
181181
182182static int istream_source (struct odb_read_stream * * out ,
183- struct repository * r ,
183+ struct object_database * odb ,
184184 const struct object_id * oid )
185185{
186186 struct odb_source * source ;
187187
188- if (!packfile_store_read_object_stream (out , r -> objects -> packfiles , oid ))
188+ if (!packfile_store_read_object_stream (out , odb -> packfiles , oid ))
189189 return 0 ;
190190
191- odb_prepare_alternates (r -> objects );
192- for (source = r -> objects -> sources ; source ; source = source -> next )
191+ odb_prepare_alternates (odb );
192+ for (source = odb -> sources ; source ; source = source -> next )
193193 if (!odb_source_loose_read_object_stream (out , source , oid ))
194194 return 0 ;
195195
196- return open_istream_incore (out , r , oid );
196+ return open_istream_incore (out , odb , oid );
197197}
198198
199199/****************************************************************
200200 * Users of streaming interface
201201 ****************************************************************/
202202
203- int close_istream (struct odb_read_stream * st )
203+ int odb_read_stream_close (struct odb_read_stream * st )
204204{
205205 int r = st -> close (st );
206206 free (st );
207207 return r ;
208208}
209209
210- ssize_t read_istream (struct odb_read_stream * st , void * buf , size_t sz )
210+ ssize_t odb_read_stream_read (struct odb_read_stream * st , void * buf , size_t sz )
211211{
212212 return st -> read (st , buf , sz );
213213}
214214
215- struct odb_read_stream * open_istream (struct repository * r ,
216- const struct object_id * oid ,
217- enum object_type * type ,
218- unsigned long * size ,
219- struct stream_filter * filter )
215+ struct odb_read_stream * odb_read_object_stream (struct object_database * odb ,
216+ const struct object_id * oid ,
217+ enum object_type * type ,
218+ unsigned long * size ,
219+ struct stream_filter * filter )
220220{
221221 struct odb_read_stream * st ;
222- const struct object_id * real = lookup_replace_object (r , oid );
222+ const struct object_id * real = lookup_replace_object (odb -> repo , oid );
223223 int ret ;
224224
225- ret = istream_source (& st , r , real );
225+ ret = istream_source (& st , odb , real );
226226 if (ret )
227227 return NULL ;
228228
229229 if (filter ) {
230230 /* Add "&& !is_null_stream_filter(filter)" for performance */
231231 struct odb_read_stream * nst = attach_stream_filter (st , filter );
232232 if (!nst ) {
233- close_istream (st );
233+ odb_read_stream_close (st );
234234 return NULL ;
235235 }
236236 st = nst ;
@@ -253,7 +253,7 @@ int odb_stream_blob_to_fd(struct object_database *odb,
253253 ssize_t kept = 0 ;
254254 int result = -1 ;
255255
256- st = open_istream (odb -> repo , oid , & type , & sz , filter );
256+ st = odb_read_object_stream (odb , oid , & type , & sz , filter );
257257 if (!st ) {
258258 if (filter )
259259 free_stream_filter (filter );
@@ -264,7 +264,7 @@ int odb_stream_blob_to_fd(struct object_database *odb,
264264 for (;;) {
265265 char buf [1024 * 16 ];
266266 ssize_t wrote , holeto ;
267- ssize_t readlen = read_istream (st , buf , sizeof (buf ));
267+ ssize_t readlen = odb_read_stream_read (st , buf , sizeof (buf ));
268268
269269 if (readlen < 0 )
270270 goto close_and_exit ;
@@ -295,6 +295,6 @@ int odb_stream_blob_to_fd(struct object_database *odb,
295295 result = 0 ;
296296
297297 close_and_exit :
298- close_istream (st );
298+ odb_read_stream_close (st );
299299 return result ;
300300}
0 commit comments