Skip to content

Commit 9a329bd

Browse files
committed
Merge branch 'ab/reftable-build-fixes'
A few portability tweaks. * ab/reftable-build-fixes: reftable tests: avoid "int" overflow, use "uint64_t" reftable: avoid initializing structs from structs
2 parents 31e3912 + 22d2f70 commit 9a329bd

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

reftable/merged_test.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ license that can be found in the LICENSE file or at
2424
static void write_test_table(struct strbuf *buf,
2525
struct reftable_ref_record refs[], int n)
2626
{
27-
int min = 0xffffffff;
28-
int max = 0;
27+
uint64_t min = 0xffffffff;
28+
uint64_t max = 0;
2929
int i = 0;
3030
int err;
3131

@@ -207,11 +207,11 @@ static void test_merged(void)
207207
},
208208
};
209209

210-
struct reftable_ref_record want[] = {
211-
r2[0],
212-
r1[1],
213-
r3[0],
214-
r3[1],
210+
struct reftable_ref_record *want[] = {
211+
&r2[0],
212+
&r1[1],
213+
&r3[0],
214+
&r3[1],
215215
};
216216

217217
struct reftable_ref_record *refs[] = { r1, r2, r3 };
@@ -250,7 +250,7 @@ static void test_merged(void)
250250

251251
EXPECT(ARRAY_SIZE(want) == len);
252252
for (i = 0; i < len; i++) {
253-
EXPECT(reftable_ref_record_equal(&want[i], &out[i],
253+
EXPECT(reftable_ref_record_equal(want[i], &out[i],
254254
GIT_SHA1_RAWSZ));
255255
}
256256
for (i = 0; i < len; i++) {
@@ -345,10 +345,10 @@ static void test_merged_logs(void)
345345
.value_type = REFTABLE_LOG_DELETION,
346346
},
347347
};
348-
struct reftable_log_record want[] = {
349-
r2[0],
350-
r3[0],
351-
r1[1],
348+
struct reftable_log_record *want[] = {
349+
&r2[0],
350+
&r3[0],
351+
&r1[1],
352352
};
353353

354354
struct reftable_log_record *logs[] = { r1, r2, r3 };
@@ -387,7 +387,7 @@ static void test_merged_logs(void)
387387

388388
EXPECT(ARRAY_SIZE(want) == len);
389389
for (i = 0; i < len; i++) {
390-
EXPECT(reftable_log_record_equal(&want[i], &out[i],
390+
EXPECT(reftable_log_record_equal(want[i], &out[i],
391391
GIT_SHA1_RAWSZ));
392392
}
393393

0 commit comments

Comments
 (0)