@@ -259,58 +259,6 @@ static void reftable_ref_record_copy_from(void *rec, const void *src_rec,
259259 }
260260}
261261
262- static char hexdigit (int c )
263- {
264- if (c <= 9 )
265- return '0' + c ;
266- return 'a' + (c - 10 );
267- }
268-
269- static void hex_format (char * dest , const unsigned char * src , int hash_size )
270- {
271- assert (hash_size > 0 );
272- if (src ) {
273- int i = 0 ;
274- for (i = 0 ; i < hash_size ; i ++ ) {
275- dest [2 * i ] = hexdigit (src [i ] >> 4 );
276- dest [2 * i + 1 ] = hexdigit (src [i ] & 0xf );
277- }
278- dest [2 * hash_size ] = 0 ;
279- }
280- }
281-
282- static void reftable_ref_record_print_sz (const struct reftable_ref_record * ref ,
283- int hash_size )
284- {
285- char hex [GIT_MAX_HEXSZ + 1 ] = { 0 }; /* BUG */
286- printf ("ref{%s(%" PRIu64 ") " , ref -> refname , ref -> update_index );
287- switch (ref -> value_type ) {
288- case REFTABLE_REF_SYMREF :
289- printf ("=> %s" , ref -> value .symref );
290- break ;
291- case REFTABLE_REF_VAL2 :
292- hex_format (hex , ref -> value .val2 .value , hash_size );
293- printf ("val 2 %s" , hex );
294- hex_format (hex , ref -> value .val2 .target_value ,
295- hash_size );
296- printf ("(T %s)" , hex );
297- break ;
298- case REFTABLE_REF_VAL1 :
299- hex_format (hex , ref -> value .val1 , hash_size );
300- printf ("val 1 %s" , hex );
301- break ;
302- case REFTABLE_REF_DELETION :
303- printf ("delete" );
304- break ;
305- }
306- printf ("}\n" );
307- }
308-
309- void reftable_ref_record_print (const struct reftable_ref_record * ref ,
310- uint32_t hash_id ) {
311- reftable_ref_record_print_sz (ref , hash_size (hash_id ));
312- }
313-
314262static void reftable_ref_record_release_void (void * rec )
315263{
316264 reftable_ref_record_release (rec );
@@ -480,12 +428,6 @@ static int reftable_ref_record_cmp_void(const void *_a, const void *_b)
480428 return strcmp (a -> refname , b -> refname );
481429}
482430
483- static void reftable_ref_record_print_void (const void * rec ,
484- int hash_size )
485- {
486- reftable_ref_record_print_sz ((struct reftable_ref_record * ) rec , hash_size );
487- }
488-
489431static struct reftable_record_vtable reftable_ref_record_vtable = {
490432 .key = & reftable_ref_record_key ,
491433 .type = BLOCK_TYPE_REF ,
@@ -497,7 +439,6 @@ static struct reftable_record_vtable reftable_ref_record_vtable = {
497439 .is_deletion = & reftable_ref_record_is_deletion_void ,
498440 .equal = & reftable_ref_record_equal_void ,
499441 .cmp = & reftable_ref_record_cmp_void ,
500- .print = & reftable_ref_record_print_void ,
501442};
502443
503444static void reftable_obj_record_key (const void * r , struct strbuf * dest )
@@ -516,21 +457,6 @@ static void reftable_obj_record_release(void *rec)
516457 memset (obj , 0 , sizeof (struct reftable_obj_record ));
517458}
518459
519- static void reftable_obj_record_print (const void * rec , int hash_size )
520- {
521- const struct reftable_obj_record * obj = rec ;
522- char hex [GIT_MAX_HEXSZ + 1 ] = { 0 };
523- struct strbuf offset_str = STRBUF_INIT ;
524- int i ;
525-
526- for (i = 0 ; i < obj -> offset_len ; i ++ )
527- strbuf_addf (& offset_str , "%" PRIu64 " " , obj -> offsets [i ]);
528- hex_format (hex , obj -> hash_prefix , obj -> hash_prefix_len );
529- printf ("prefix %s (len %d), offsets [%s]\n" ,
530- hex , obj -> hash_prefix_len , offset_str .buf );
531- strbuf_release (& offset_str );
532- }
533-
534460static void reftable_obj_record_copy_from (void * rec , const void * src_rec ,
535461 int hash_size )
536462{
@@ -701,41 +627,8 @@ static struct reftable_record_vtable reftable_obj_record_vtable = {
701627 .is_deletion = & not_a_deletion ,
702628 .equal = & reftable_obj_record_equal_void ,
703629 .cmp = & reftable_obj_record_cmp_void ,
704- .print = & reftable_obj_record_print ,
705630};
706631
707- static void reftable_log_record_print_sz (struct reftable_log_record * log ,
708- int hash_size )
709- {
710- char hex [GIT_MAX_HEXSZ + 1 ] = { 0 };
711-
712- switch (log -> value_type ) {
713- case REFTABLE_LOG_DELETION :
714- printf ("log{%s(%" PRIu64 ") delete\n" , log -> refname ,
715- log -> update_index );
716- break ;
717- case REFTABLE_LOG_UPDATE :
718- printf ("log{%s(%" PRIu64 ") %s <%s> %" PRIu64 " %04d\n" ,
719- log -> refname , log -> update_index ,
720- log -> value .update .name ? log -> value .update .name : "" ,
721- log -> value .update .email ? log -> value .update .email : "" ,
722- log -> value .update .time ,
723- log -> value .update .tz_offset );
724- hex_format (hex , log -> value .update .old_hash , hash_size );
725- printf ("%s => " , hex );
726- hex_format (hex , log -> value .update .new_hash , hash_size );
727- printf ("%s\n\n%s\n}\n" , hex ,
728- log -> value .update .message ? log -> value .update .message : "" );
729- break ;
730- }
731- }
732-
733- void reftable_log_record_print (struct reftable_log_record * log ,
734- uint32_t hash_id )
735- {
736- reftable_log_record_print_sz (log , hash_size (hash_id ));
737- }
738-
739632static void reftable_log_record_key (const void * r , struct strbuf * dest )
740633{
741634 const struct reftable_log_record * rec =
@@ -1039,11 +932,6 @@ static int reftable_log_record_is_deletion_void(const void *p)
1039932 (const struct reftable_log_record * )p );
1040933}
1041934
1042- static void reftable_log_record_print_void (const void * rec , int hash_size )
1043- {
1044- reftable_log_record_print_sz ((struct reftable_log_record * )rec , hash_size );
1045- }
1046-
1047935static struct reftable_record_vtable reftable_log_record_vtable = {
1048936 .key = & reftable_log_record_key ,
1049937 .type = BLOCK_TYPE_LOG ,
@@ -1055,7 +943,6 @@ static struct reftable_record_vtable reftable_log_record_vtable = {
1055943 .is_deletion = & reftable_log_record_is_deletion_void ,
1056944 .equal = & reftable_log_record_equal_void ,
1057945 .cmp = & reftable_log_record_cmp_void ,
1058- .print = & reftable_log_record_print_void ,
1059946};
1060947
1061948static void reftable_index_record_key (const void * r , struct strbuf * dest )
@@ -1137,13 +1024,6 @@ static int reftable_index_record_cmp(const void *_a, const void *_b)
11371024 return strbuf_cmp (& a -> last_key , & b -> last_key );
11381025}
11391026
1140- static void reftable_index_record_print (const void * rec , int hash_size )
1141- {
1142- const struct reftable_index_record * idx = rec ;
1143- /* TODO: escape null chars? */
1144- printf ("\"%s\" %" PRIu64 "\n" , idx -> last_key .buf , idx -> offset );
1145- }
1146-
11471027static struct reftable_record_vtable reftable_index_record_vtable = {
11481028 .key = & reftable_index_record_key ,
11491029 .type = BLOCK_TYPE_INDEX ,
@@ -1155,7 +1035,6 @@ static struct reftable_record_vtable reftable_index_record_vtable = {
11551035 .is_deletion = & not_a_deletion ,
11561036 .equal = & reftable_index_record_equal ,
11571037 .cmp = & reftable_index_record_cmp ,
1158- .print = & reftable_index_record_print ,
11591038};
11601039
11611040void reftable_record_key (struct reftable_record * rec , struct strbuf * dest )
@@ -1334,9 +1213,3 @@ void reftable_record_init(struct reftable_record *rec, uint8_t typ)
13341213 BUG ("unhandled record type" );
13351214 }
13361215}
1337-
1338- void reftable_record_print (struct reftable_record * rec , int hash_size )
1339- {
1340- printf ("'%c': " , rec -> type );
1341- reftable_record_vtable (rec )-> print (reftable_record_data (rec ), hash_size );
1342- }
0 commit comments