@@ -229,16 +229,14 @@ static int reftable_ref_record_key(const void *r, struct reftable_buf *dest)
229
229
}
230
230
231
231
static int reftable_ref_record_copy_from (void * rec , const void * src_rec ,
232
- int hash_size )
232
+ uint32_t hash_size )
233
233
{
234
234
struct reftable_ref_record * ref = rec ;
235
235
const struct reftable_ref_record * src = src_rec ;
236
236
char * refname = NULL ;
237
237
size_t refname_cap = 0 ;
238
238
int err ;
239
239
240
- assert (hash_size > 0 );
241
-
242
240
SWAP (refname , ref -> refname );
243
241
SWAP (refname_cap , ref -> refname_cap );
244
242
reftable_ref_record_release (ref );
@@ -319,13 +317,12 @@ static uint8_t reftable_ref_record_val_type(const void *rec)
319
317
}
320
318
321
319
static int reftable_ref_record_encode (const void * rec , struct string_view s ,
322
- int hash_size )
320
+ uint32_t hash_size )
323
321
{
324
322
const struct reftable_ref_record * r =
325
323
(const struct reftable_ref_record * )rec ;
326
324
struct string_view start = s ;
327
325
int n = put_var_int (& s , r -> update_index );
328
- assert (hash_size > 0 );
329
326
if (n < 0 )
330
327
return -1 ;
331
328
string_view_consume (& s , n );
@@ -365,7 +362,7 @@ static int reftable_ref_record_encode(const void *rec, struct string_view s,
365
362
366
363
static int reftable_ref_record_decode (void * rec , struct reftable_buf key ,
367
364
uint8_t val_type , struct string_view in ,
368
- int hash_size , struct reftable_buf * scratch )
365
+ uint32_t hash_size , struct reftable_buf * scratch )
369
366
{
370
367
struct reftable_ref_record * r = rec ;
371
368
struct string_view start = in ;
@@ -374,8 +371,6 @@ static int reftable_ref_record_decode(void *rec, struct reftable_buf key,
374
371
size_t refname_cap = 0 ;
375
372
int n , err ;
376
373
377
- assert (hash_size > 0 );
378
-
379
374
n = get_var_int (& update_index , & in );
380
375
if (n < 0 )
381
376
return n ;
@@ -451,7 +446,7 @@ static int reftable_ref_record_is_deletion_void(const void *p)
451
446
}
452
447
453
448
static int reftable_ref_record_equal_void (const void * a ,
454
- const void * b , int hash_size )
449
+ const void * b , uint32_t hash_size )
455
450
{
456
451
struct reftable_ref_record * ra = (struct reftable_ref_record * ) a ;
457
452
struct reftable_ref_record * rb = (struct reftable_ref_record * ) b ;
@@ -495,7 +490,7 @@ static void reftable_obj_record_release(void *rec)
495
490
}
496
491
497
492
static int reftable_obj_record_copy_from (void * rec , const void * src_rec ,
498
- int hash_size UNUSED )
493
+ uint32_t hash_size UNUSED )
499
494
{
500
495
struct reftable_obj_record * obj = rec ;
501
496
const struct reftable_obj_record * src = src_rec ;
@@ -527,7 +522,7 @@ static uint8_t reftable_obj_record_val_type(const void *rec)
527
522
}
528
523
529
524
static int reftable_obj_record_encode (const void * rec , struct string_view s ,
530
- int hash_size UNUSED )
525
+ uint32_t hash_size UNUSED )
531
526
{
532
527
const struct reftable_obj_record * r = rec ;
533
528
struct string_view start = s ;
@@ -562,7 +557,7 @@ static int reftable_obj_record_encode(const void *rec, struct string_view s,
562
557
563
558
static int reftable_obj_record_decode (void * rec , struct reftable_buf key ,
564
559
uint8_t val_type , struct string_view in ,
565
- int hash_size UNUSED ,
560
+ uint32_t hash_size UNUSED ,
566
561
struct reftable_buf * scratch UNUSED )
567
562
{
568
563
struct string_view start = in ;
@@ -626,7 +621,7 @@ static int not_a_deletion(const void *p UNUSED)
626
621
}
627
622
628
623
static int reftable_obj_record_equal_void (const void * a , const void * b ,
629
- int hash_size UNUSED )
624
+ uint32_t hash_size UNUSED )
630
625
{
631
626
struct reftable_obj_record * ra = (struct reftable_obj_record * ) a ;
632
627
struct reftable_obj_record * rb = (struct reftable_obj_record * ) b ;
@@ -701,7 +696,7 @@ static int reftable_log_record_key(const void *r, struct reftable_buf *dest)
701
696
}
702
697
703
698
static int reftable_log_record_copy_from (void * rec , const void * src_rec ,
704
- int hash_size )
699
+ uint32_t hash_size )
705
700
{
706
701
struct reftable_log_record * dst = rec ;
707
702
const struct reftable_log_record * src =
@@ -782,7 +777,7 @@ static uint8_t reftable_log_record_val_type(const void *rec)
782
777
}
783
778
784
779
static int reftable_log_record_encode (const void * rec , struct string_view s ,
785
- int hash_size )
780
+ uint32_t hash_size )
786
781
{
787
782
const struct reftable_log_record * r = rec ;
788
783
struct string_view start = s ;
@@ -830,7 +825,7 @@ static int reftable_log_record_encode(const void *rec, struct string_view s,
830
825
831
826
static int reftable_log_record_decode (void * rec , struct reftable_buf key ,
832
827
uint8_t val_type , struct string_view in ,
833
- int hash_size , struct reftable_buf * scratch )
828
+ uint32_t hash_size , struct reftable_buf * scratch )
834
829
{
835
830
struct string_view start = in ;
836
831
struct reftable_log_record * r = rec ;
@@ -978,7 +973,7 @@ static int null_streq(const char *a, const char *b)
978
973
}
979
974
980
975
static int reftable_log_record_equal_void (const void * a ,
981
- const void * b , int hash_size )
976
+ const void * b , uint32_t hash_size )
982
977
{
983
978
return reftable_log_record_equal ((struct reftable_log_record * ) a ,
984
979
(struct reftable_log_record * ) b ,
@@ -1002,7 +997,7 @@ static int reftable_log_record_cmp_void(const void *_a, const void *_b)
1002
997
}
1003
998
1004
999
int reftable_log_record_equal (const struct reftable_log_record * a ,
1005
- const struct reftable_log_record * b , int hash_size )
1000
+ const struct reftable_log_record * b , uint32_t hash_size )
1006
1001
{
1007
1002
if (!(null_streq (a -> refname , b -> refname ) &&
1008
1003
a -> update_index == b -> update_index &&
@@ -1056,7 +1051,7 @@ static int reftable_index_record_key(const void *r, struct reftable_buf *dest)
1056
1051
}
1057
1052
1058
1053
static int reftable_index_record_copy_from (void * rec , const void * src_rec ,
1059
- int hash_size UNUSED )
1054
+ uint32_t hash_size UNUSED )
1060
1055
{
1061
1056
struct reftable_index_record * dst = rec ;
1062
1057
const struct reftable_index_record * src = src_rec ;
@@ -1083,7 +1078,7 @@ static uint8_t reftable_index_record_val_type(const void *rec UNUSED)
1083
1078
}
1084
1079
1085
1080
static int reftable_index_record_encode (const void * rec , struct string_view out ,
1086
- int hash_size UNUSED )
1081
+ uint32_t hash_size UNUSED )
1087
1082
{
1088
1083
const struct reftable_index_record * r =
1089
1084
(const struct reftable_index_record * )rec ;
@@ -1101,7 +1096,7 @@ static int reftable_index_record_encode(const void *rec, struct string_view out,
1101
1096
static int reftable_index_record_decode (void * rec , struct reftable_buf key ,
1102
1097
uint8_t val_type UNUSED ,
1103
1098
struct string_view in ,
1104
- int hash_size UNUSED ,
1099
+ uint32_t hash_size UNUSED ,
1105
1100
struct reftable_buf * scratch UNUSED )
1106
1101
{
1107
1102
struct string_view start = in ;
@@ -1122,7 +1117,7 @@ static int reftable_index_record_decode(void *rec, struct reftable_buf key,
1122
1117
}
1123
1118
1124
1119
static int reftable_index_record_equal (const void * a , const void * b ,
1125
- int hash_size UNUSED )
1120
+ uint32_t hash_size UNUSED )
1126
1121
{
1127
1122
struct reftable_index_record * ia = (struct reftable_index_record * ) a ;
1128
1123
struct reftable_index_record * ib = (struct reftable_index_record * ) b ;
@@ -1156,14 +1151,14 @@ int reftable_record_key(struct reftable_record *rec, struct reftable_buf *dest)
1156
1151
}
1157
1152
1158
1153
int reftable_record_encode (struct reftable_record * rec , struct string_view dest ,
1159
- int hash_size )
1154
+ uint32_t hash_size )
1160
1155
{
1161
1156
return reftable_record_vtable (rec )-> encode (reftable_record_data (rec ),
1162
1157
dest , hash_size );
1163
1158
}
1164
1159
1165
1160
int reftable_record_copy_from (struct reftable_record * rec ,
1166
- struct reftable_record * src , int hash_size )
1161
+ struct reftable_record * src , uint32_t hash_size )
1167
1162
{
1168
1163
assert (src -> type == rec -> type );
1169
1164
@@ -1178,7 +1173,7 @@ uint8_t reftable_record_val_type(struct reftable_record *rec)
1178
1173
}
1179
1174
1180
1175
int reftable_record_decode (struct reftable_record * rec , struct reftable_buf key ,
1181
- uint8_t extra , struct string_view src , int hash_size ,
1176
+ uint8_t extra , struct string_view src , uint32_t hash_size ,
1182
1177
struct reftable_buf * scratch )
1183
1178
{
1184
1179
return reftable_record_vtable (rec )-> decode (reftable_record_data (rec ),
@@ -1205,15 +1200,15 @@ int reftable_record_cmp(struct reftable_record *a, struct reftable_record *b)
1205
1200
reftable_record_data (a ), reftable_record_data (b ));
1206
1201
}
1207
1202
1208
- int reftable_record_equal (struct reftable_record * a , struct reftable_record * b , int hash_size )
1203
+ int reftable_record_equal (struct reftable_record * a , struct reftable_record * b , uint32_t hash_size )
1209
1204
{
1210
1205
if (a -> type != b -> type )
1211
1206
return 0 ;
1212
1207
return reftable_record_vtable (a )-> equal (
1213
1208
reftable_record_data (a ), reftable_record_data (b ), hash_size );
1214
1209
}
1215
1210
1216
- static int hash_equal (const unsigned char * a , const unsigned char * b , int hash_size )
1211
+ static int hash_equal (const unsigned char * a , const unsigned char * b , uint32_t hash_size )
1217
1212
{
1218
1213
if (a && b )
1219
1214
return !memcmp (a , b , hash_size );
@@ -1222,9 +1217,8 @@ static int hash_equal(const unsigned char *a, const unsigned char *b, int hash_s
1222
1217
}
1223
1218
1224
1219
int reftable_ref_record_equal (const struct reftable_ref_record * a ,
1225
- const struct reftable_ref_record * b , int hash_size )
1220
+ const struct reftable_ref_record * b , uint32_t hash_size )
1226
1221
{
1227
- assert (hash_size > 0 );
1228
1222
if (!null_streq (a -> refname , b -> refname ))
1229
1223
return 0 ;
1230
1224
0 commit comments