@@ -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,47 +180,47 @@ 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_stream_open (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 );
223- int ret = istream_source (& st , r , real );
222+ const struct object_id * real = lookup_replace_object (odb -> repo , oid );
223+ int ret = istream_source (& st , odb , real );
224224
225225 if (ret )
226226 return NULL ;
@@ -229,7 +229,7 @@ struct odb_read_stream *open_istream(struct repository *r,
229229 /* Add "&& !is_null_stream_filter(filter)" for performance */
230230 struct odb_read_stream * nst = attach_stream_filter (st , filter );
231231 if (!nst ) {
232- close_istream (st );
232+ odb_read_stream_close (st );
233233 return NULL ;
234234 }
235235 st = nst ;
@@ -252,7 +252,7 @@ int odb_stream_blob_to_fd(struct object_database *odb,
252252 ssize_t kept = 0 ;
253253 int result = -1 ;
254254
255- st = open_istream (odb -> repo , oid , & type , & sz , filter );
255+ st = odb_read_stream_open (odb , oid , & type , & sz , filter );
256256 if (!st ) {
257257 if (filter )
258258 free_stream_filter (filter );
@@ -263,7 +263,7 @@ int odb_stream_blob_to_fd(struct object_database *odb,
263263 for (;;) {
264264 char buf [1024 * 16 ];
265265 ssize_t wrote , holeto ;
266- ssize_t readlen = read_istream (st , buf , sizeof (buf ));
266+ ssize_t readlen = odb_read_stream_read (st , buf , sizeof (buf ));
267267
268268 if (readlen < 0 )
269269 goto close_and_exit ;
@@ -294,6 +294,6 @@ int odb_stream_blob_to_fd(struct object_database *odb,
294294 result = 0 ;
295295
296296 close_and_exit :
297- close_istream (st );
297+ odb_read_stream_close (st );
298298 return result ;
299299}
0 commit comments