Skip to content

Commit 88f59d9

Browse files
pks-tgitster
authored andcommitted
reftable/record: constify some parts of the interface
We're about to convert reftable records to stop storing their object IDs as allocated hashes. Prepare for this refactoring by constifying some parts of the interface that will be impacted by this. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ddac965 commit 88f59d9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

reftable/record.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int reftable_is_block_type(uint8_t typ)
7676
return 0;
7777
}
7878

79-
uint8_t *reftable_ref_record_val1(const struct reftable_ref_record *rec)
79+
const unsigned char *reftable_ref_record_val1(const struct reftable_ref_record *rec)
8080
{
8181
switch (rec->value_type) {
8282
case REFTABLE_REF_VAL1:
@@ -88,7 +88,7 @@ uint8_t *reftable_ref_record_val1(const struct reftable_ref_record *rec)
8888
}
8989
}
9090

91-
uint8_t *reftable_ref_record_val2(const struct reftable_ref_record *rec)
91+
const unsigned char *reftable_ref_record_val2(const struct reftable_ref_record *rec)
9292
{
9393
switch (rec->value_type) {
9494
case REFTABLE_REF_VAL2:
@@ -242,7 +242,7 @@ static char hexdigit(int c)
242242
return 'a' + (c - 10);
243243
}
244244

245-
static void hex_format(char *dest, uint8_t *src, int hash_size)
245+
static void hex_format(char *dest, const unsigned char *src, int hash_size)
246246
{
247247
assert(hash_size > 0);
248248
if (src) {
@@ -1164,7 +1164,7 @@ int reftable_record_equal(struct reftable_record *a, struct reftable_record *b,
11641164
reftable_record_data(a), reftable_record_data(b), hash_size);
11651165
}
11661166

1167-
static int hash_equal(uint8_t *a, uint8_t *b, int hash_size)
1167+
static int hash_equal(const unsigned char *a, const unsigned char *b, int hash_size)
11681168
{
11691169
if (a && b)
11701170
return !memcmp(a, b, hash_size);

reftable/reftable-record.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ struct reftable_ref_record {
4949

5050
/* Returns the first hash, or NULL if `rec` is not of type
5151
* REFTABLE_REF_VAL1 or REFTABLE_REF_VAL2. */
52-
uint8_t *reftable_ref_record_val1(const struct reftable_ref_record *rec);
52+
const unsigned char *reftable_ref_record_val1(const struct reftable_ref_record *rec);
5353

5454
/* Returns the second hash, or NULL if `rec` is not of type
5555
* REFTABLE_REF_VAL2. */
56-
uint8_t *reftable_ref_record_val2(const struct reftable_ref_record *rec);
56+
const unsigned char *reftable_ref_record_val2(const struct reftable_ref_record *rec);
5757

5858
/* returns whether 'ref' represents a deletion */
5959
int reftable_ref_record_is_deletion(const struct reftable_ref_record *ref);

0 commit comments

Comments
 (0)