@@ -38,7 +38,7 @@ int footer_size(int version)
3838}
3939
4040static int block_writer_register_restart (struct block_writer * w , int n ,
41- int is_restart , struct strbuf * key )
41+ int is_restart , struct reftable_buf * key )
4242{
4343 int rlen = w -> restart_len ;
4444 if (rlen >= MAX_RESTARTS ) {
@@ -59,8 +59,8 @@ static int block_writer_register_restart(struct block_writer *w, int n,
5959
6060 w -> next += n ;
6161
62- strbuf_reset (& w -> last_key );
63- strbuf_add (& w -> last_key , key -> buf , key -> len );
62+ reftable_buf_reset (& w -> last_key );
63+ reftable_buf_add (& w -> last_key , key -> buf , key -> len );
6464 w -> entries ++ ;
6565 return 0 ;
6666}
@@ -98,8 +98,8 @@ uint8_t block_writer_type(struct block_writer *bw)
9898 empty key. */
9999int block_writer_add (struct block_writer * w , struct reftable_record * rec )
100100{
101- struct strbuf empty = STRBUF_INIT ;
102- struct strbuf last =
101+ struct reftable_buf empty = REFTABLE_BUF_INIT ;
102+ struct reftable_buf last =
103103 w -> entries % w -> restart_interval == 0 ? empty : w -> last_key ;
104104 struct string_view out = {
105105 .buf = w -> buf + w -> next ,
@@ -109,7 +109,7 @@ int block_writer_add(struct block_writer *w, struct reftable_record *rec)
109109 struct string_view start = out ;
110110
111111 int is_restart = 0 ;
112- struct strbuf key = STRBUF_INIT ;
112+ struct reftable_buf key = REFTABLE_BUF_INIT ;
113113 int n = 0 ;
114114 int err = -1 ;
115115
@@ -133,7 +133,7 @@ int block_writer_add(struct block_writer *w, struct reftable_record *rec)
133133 err = block_writer_register_restart (w , start .len - out .len , is_restart ,
134134 & key );
135135done :
136- strbuf_release (& key );
136+ reftable_buf_release (& key );
137137 return err ;
138138}
139139
@@ -325,7 +325,7 @@ uint8_t block_reader_type(const struct block_reader *r)
325325 return r -> block .data [r -> header_off ];
326326}
327327
328- int block_reader_first_key (const struct block_reader * br , struct strbuf * key )
328+ int block_reader_first_key (const struct block_reader * br , struct reftable_buf * key )
329329{
330330 int off = br -> header_off + 4 , n ;
331331 struct string_view in = {
@@ -334,7 +334,7 @@ int block_reader_first_key(const struct block_reader *br, struct strbuf *key)
334334 };
335335 uint8_t extra = 0 ;
336336
337- strbuf_reset (key );
337+ reftable_buf_reset (key );
338338
339339 n = reftable_decode_key (key , & extra , in );
340340 if (n < 0 )
@@ -355,13 +355,13 @@ void block_iter_seek_start(struct block_iter *it, const struct block_reader *br)
355355 it -> block = br -> block .data ;
356356 it -> block_len = br -> block_len ;
357357 it -> hash_size = br -> hash_size ;
358- strbuf_reset (& it -> last_key );
358+ reftable_buf_reset (& it -> last_key );
359359 it -> next_off = br -> header_off + 4 ;
360360}
361361
362362struct restart_needle_less_args {
363363 int error ;
364- struct strbuf needle ;
364+ struct reftable_buf needle ;
365365 const struct block_reader * reader ;
366366};
367367
@@ -433,7 +433,7 @@ int block_iter_next(struct block_iter *it, struct reftable_record *rec)
433433
434434void block_iter_reset (struct block_iter * it )
435435{
436- strbuf_reset (& it -> last_key );
436+ reftable_buf_reset (& it -> last_key );
437437 it -> next_off = 0 ;
438438 it -> block = NULL ;
439439 it -> block_len = 0 ;
@@ -442,12 +442,12 @@ void block_iter_reset(struct block_iter *it)
442442
443443void block_iter_close (struct block_iter * it )
444444{
445- strbuf_release (& it -> last_key );
446- strbuf_release (& it -> scratch );
445+ reftable_buf_release (& it -> last_key );
446+ reftable_buf_release (& it -> scratch );
447447}
448448
449449int block_iter_seek_key (struct block_iter * it , const struct block_reader * br ,
450- struct strbuf * want )
450+ struct reftable_buf * want )
451451{
452452 struct restart_needle_less_args args = {
453453 .needle = * want ,
@@ -537,7 +537,7 @@ int block_iter_seek_key(struct block_iter *it, const struct block_reader *br,
537537 * with themselves.
538538 */
539539 reftable_record_key (& rec , & it -> last_key );
540- if (strbuf_cmp (& it -> last_key , want ) >= 0 ) {
540+ if (reftable_buf_cmp (& it -> last_key , want ) >= 0 ) {
541541 it -> next_off = prev_off ;
542542 goto done ;
543543 }
@@ -554,7 +554,7 @@ void block_writer_release(struct block_writer *bw)
554554 REFTABLE_FREE_AND_NULL (bw -> zstream );
555555 REFTABLE_FREE_AND_NULL (bw -> restarts );
556556 REFTABLE_FREE_AND_NULL (bw -> compressed );
557- strbuf_release (& bw -> last_key );
557+ reftable_buf_release (& bw -> last_key );
558558 /* the block is not owned. */
559559}
560560
0 commit comments