@@ -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 ;
@@ -162,7 +162,7 @@ static int open_istream_incore(struct odb_read_stream **out,
162162 oi .typep = & stream .base .type ;
163163 oi .sizep = & stream .base .size ;
164164 oi .contentp = (void * * )& stream .buf ;
165- ret = odb_read_object_info_extended (r -> objects , oid , & oi ,
165+ ret = odb_read_object_info_extended (odb , oid , & oi ,
166166 OBJECT_INFO_DIE_IF_CORRUPT );
167167 if (ret )
168168 return ret ;
@@ -179,57 +179,57 @@ static int open_istream_incore(struct odb_read_stream **out,
179179 *****************************************************************************/
180180
181181static int istream_source (struct odb_read_stream * * out ,
182- struct repository * r ,
182+ struct object_database * odb ,
183183 const struct object_id * oid )
184184{
185185 struct odb_source * source ;
186186
187- if (!packfile_store_read_object_stream (out , r -> objects -> packfiles , oid ))
187+ if (!packfile_store_read_object_stream (out , odb -> packfiles , oid ))
188188 return 0 ;
189189
190- odb_prepare_alternates (r -> objects );
191- for (source = r -> objects -> sources ; source ; source = source -> next )
190+ odb_prepare_alternates (odb );
191+ for (source = odb -> sources ; source ; source = source -> next )
192192 if (!odb_source_loose_read_object_stream (out , source , oid ))
193193 return 0 ;
194194
195- return open_istream_incore (out , r , oid );
195+ return open_istream_incore (out , odb , oid );
196196}
197197
198198/****************************************************************
199199 * Users of streaming interface
200200 ****************************************************************/
201201
202- int close_istream (struct odb_read_stream * st )
202+ int odb_read_stream_close (struct odb_read_stream * st )
203203{
204204 int r = st -> close (st );
205205 free (st );
206206 return r ;
207207}
208208
209- ssize_t read_istream (struct odb_read_stream * st , void * buf , size_t sz )
209+ ssize_t odb_read_stream_read (struct odb_read_stream * st , void * buf , size_t sz )
210210{
211211 return st -> read (st , buf , sz );
212212}
213213
214- struct odb_read_stream * open_istream (struct repository * r ,
215- const struct object_id * oid ,
216- enum object_type * type ,
217- unsigned long * size ,
218- struct stream_filter * filter )
214+ struct odb_read_stream * odb_read_object_stream (struct object_database * odb ,
215+ const struct object_id * oid ,
216+ enum object_type * type ,
217+ unsigned long * size ,
218+ struct stream_filter * filter )
219219{
220220 struct odb_read_stream * st ;
221- const struct object_id * real = lookup_replace_object (r , oid );
221+ const struct object_id * real = lookup_replace_object (odb -> repo , oid );
222222 int ret ;
223223
224- ret = istream_source (& st , r , real );
224+ ret = istream_source (& st , odb , real );
225225 if (ret )
226226 return NULL ;
227227
228228 if (filter ) {
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_object_stream (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