@@ -259,58 +259,6 @@ static void reftable_ref_record_copy_from(void *rec, const void *src_rec,
259
259
}
260
260
}
261
261
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
-
314
262
static void reftable_ref_record_release_void (void * rec )
315
263
{
316
264
reftable_ref_record_release (rec );
@@ -480,12 +428,6 @@ static int reftable_ref_record_cmp_void(const void *_a, const void *_b)
480
428
return strcmp (a -> refname , b -> refname );
481
429
}
482
430
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
-
489
431
static struct reftable_record_vtable reftable_ref_record_vtable = {
490
432
.key = & reftable_ref_record_key ,
491
433
.type = BLOCK_TYPE_REF ,
@@ -497,7 +439,6 @@ static struct reftable_record_vtable reftable_ref_record_vtable = {
497
439
.is_deletion = & reftable_ref_record_is_deletion_void ,
498
440
.equal = & reftable_ref_record_equal_void ,
499
441
.cmp = & reftable_ref_record_cmp_void ,
500
- .print = & reftable_ref_record_print_void ,
501
442
};
502
443
503
444
static void reftable_obj_record_key (const void * r , struct strbuf * dest )
@@ -516,21 +457,6 @@ static void reftable_obj_record_release(void *rec)
516
457
memset (obj , 0 , sizeof (struct reftable_obj_record ));
517
458
}
518
459
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
-
534
460
static void reftable_obj_record_copy_from (void * rec , const void * src_rec ,
535
461
int hash_size )
536
462
{
@@ -701,41 +627,8 @@ static struct reftable_record_vtable reftable_obj_record_vtable = {
701
627
.is_deletion = & not_a_deletion ,
702
628
.equal = & reftable_obj_record_equal_void ,
703
629
.cmp = & reftable_obj_record_cmp_void ,
704
- .print = & reftable_obj_record_print ,
705
630
};
706
631
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
-
739
632
static void reftable_log_record_key (const void * r , struct strbuf * dest )
740
633
{
741
634
const struct reftable_log_record * rec =
@@ -1039,11 +932,6 @@ static int reftable_log_record_is_deletion_void(const void *p)
1039
932
(const struct reftable_log_record * )p );
1040
933
}
1041
934
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
-
1047
935
static struct reftable_record_vtable reftable_log_record_vtable = {
1048
936
.key = & reftable_log_record_key ,
1049
937
.type = BLOCK_TYPE_LOG ,
@@ -1055,7 +943,6 @@ static struct reftable_record_vtable reftable_log_record_vtable = {
1055
943
.is_deletion = & reftable_log_record_is_deletion_void ,
1056
944
.equal = & reftable_log_record_equal_void ,
1057
945
.cmp = & reftable_log_record_cmp_void ,
1058
- .print = & reftable_log_record_print_void ,
1059
946
};
1060
947
1061
948
static 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)
1137
1024
return strbuf_cmp (& a -> last_key , & b -> last_key );
1138
1025
}
1139
1026
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
-
1147
1027
static struct reftable_record_vtable reftable_index_record_vtable = {
1148
1028
.key = & reftable_index_record_key ,
1149
1029
.type = BLOCK_TYPE_INDEX ,
@@ -1155,7 +1035,6 @@ static struct reftable_record_vtable reftable_index_record_vtable = {
1155
1035
.is_deletion = & not_a_deletion ,
1156
1036
.equal = & reftable_index_record_equal ,
1157
1037
.cmp = & reftable_index_record_cmp ,
1158
- .print = & reftable_index_record_print ,
1159
1038
};
1160
1039
1161
1040
void 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)
1334
1213
BUG ("unhandled record type" );
1335
1214
}
1336
1215
}
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