Skip to content

Commit a94b945

Browse files
hanwengitster
authored andcommitted
reftable: make reftable-record.h function signatures const correct
Signed-off-by: Han-Wen Nienhuys <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 049cdbb commit a94b945

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

reftable/record.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int reftable_is_block_type(uint8_t typ)
7272
return 0;
7373
}
7474

75-
uint8_t *reftable_ref_record_val1(struct reftable_ref_record *rec)
75+
uint8_t *reftable_ref_record_val1(const struct reftable_ref_record *rec)
7676
{
7777
switch (rec->value_type) {
7878
case REFTABLE_REF_VAL1:
@@ -84,7 +84,7 @@ uint8_t *reftable_ref_record_val1(struct reftable_ref_record *rec)
8484
}
8585
}
8686

87-
uint8_t *reftable_ref_record_val2(struct reftable_ref_record *rec)
87+
uint8_t *reftable_ref_record_val2(const struct reftable_ref_record *rec)
8888
{
8989
switch (rec->value_type) {
9090
case REFTABLE_REF_VAL2:
@@ -251,7 +251,7 @@ static void hex_format(char *dest, uint8_t *src, int hash_size)
251251
}
252252
}
253253

254-
void reftable_ref_record_print(struct reftable_ref_record *ref,
254+
void reftable_ref_record_print(const struct reftable_ref_record *ref,
255255
uint32_t hash_id)
256256
{
257257
char hex[GIT_MAX_HEXSZ + 1] = { 0 }; /* BUG */
@@ -881,8 +881,8 @@ static int zero_hash_eq(uint8_t *a, uint8_t *b, int sz)
881881
return !memcmp(a, b, sz);
882882
}
883883

884-
int reftable_log_record_equal(struct reftable_log_record *a,
885-
struct reftable_log_record *b, int hash_size)
884+
int reftable_log_record_equal(const struct reftable_log_record *a,
885+
const struct reftable_log_record *b, int hash_size)
886886
{
887887
if (!(null_streq(a->refname, b->refname) &&
888888
a->update_index == b->update_index &&
@@ -1150,8 +1150,8 @@ static int hash_equal(uint8_t *a, uint8_t *b, int hash_size)
11501150
return a == b;
11511151
}
11521152

1153-
int reftable_ref_record_equal(struct reftable_ref_record *a,
1154-
struct reftable_ref_record *b, int hash_size)
1153+
int reftable_ref_record_equal(const struct reftable_ref_record *a,
1154+
const struct reftable_ref_record *b, int hash_size)
11551155
{
11561156
assert(hash_size > 0);
11571157
if (!null_streq(a->refname, b->refname))

reftable/reftable-record.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,25 @@ 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(struct reftable_ref_record *rec);
52+
uint8_t *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(struct reftable_ref_record *rec);
56+
uint8_t *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);
6060

6161
/* prints a reftable_ref_record onto stdout. Useful for debugging. */
62-
void reftable_ref_record_print(struct reftable_ref_record *ref,
62+
void reftable_ref_record_print(const struct reftable_ref_record *ref,
6363
uint32_t hash_id);
6464

6565
/* frees and nulls all pointer values inside `ref`. */
6666
void reftable_ref_record_release(struct reftable_ref_record *ref);
6767

6868
/* returns whether two reftable_ref_records are the same. Useful for testing. */
69-
int reftable_ref_record_equal(struct reftable_ref_record *a,
70-
struct reftable_ref_record *b, int hash_size);
69+
int reftable_ref_record_equal(const struct reftable_ref_record *a,
70+
const struct reftable_ref_record *b, int hash_size);
7171

7272
/* reftable_log_record holds a reflog entry */
7373
struct reftable_log_record {
@@ -104,8 +104,8 @@ int reftable_log_record_is_deletion(const struct reftable_log_record *log);
104104
void reftable_log_record_release(struct reftable_log_record *log);
105105

106106
/* returns whether two records are equal. Useful for testing. */
107-
int reftable_log_record_equal(struct reftable_log_record *a,
108-
struct reftable_log_record *b, int hash_size);
107+
int reftable_log_record_equal(const struct reftable_log_record *a,
108+
const struct reftable_log_record *b, int hash_size);
109109

110110
/* dumps a reftable_log_record on stdout, for debugging/testing. */
111111
void reftable_log_record_print(struct reftable_log_record *log,

0 commit comments

Comments
 (0)