Skip to content

Commit 259ec8f

Browse files
committed
Merge branch 'ab/reftable-aix-xlc-12'
Work around AIX C compiler that does not seem to grok initialization of a union member of a struct. * ab/reftable-aix-xlc-12: reftable: make assignments portable to AIX xlc v12.01
2 parents cf0e875 + 33665d9 commit 259ec8f

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

reftable/generic.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ int reftable_iterator_next_ref(struct reftable_iterator *it,
130130
{
131131
struct reftable_record rec = {
132132
.type = BLOCK_TYPE_REF,
133-
.u.ref = *ref,
133+
.u = {
134+
.ref = *ref
135+
},
134136
};
135137
int err = iterator_next(it, &rec);
136138
*ref = rec.u.ref;
@@ -142,7 +144,9 @@ int reftable_iterator_next_log(struct reftable_iterator *it,
142144
{
143145
struct reftable_record rec = {
144146
.type = BLOCK_TYPE_LOG,
145-
.u.log = *log,
147+
.u = {
148+
.log = *log,
149+
},
146150
};
147151
int err = iterator_next(it, &rec);
148152
*log = rec.u.log;

reftable/record_test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@ static void test_reftable_obj_record_roundtrip(void)
339339
};
340340
struct reftable_record in = {
341341
.type = BLOCK_TYPE_OBJ,
342-
.u.obj = recs[i],
342+
.u = {
343+
.obj = recs[i],
344+
},
343345
};
344346
struct strbuf key = STRBUF_INIT;
345347
struct reftable_record out = { .type = BLOCK_TYPE_OBJ };

reftable/writer.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ int reftable_writer_add_ref(struct reftable_writer *w,
257257
{
258258
struct reftable_record rec = {
259259
.type = BLOCK_TYPE_REF,
260-
.u.ref = *ref,
260+
.u = {
261+
.ref = *ref
262+
},
261263
};
262264
int err = 0;
263265

@@ -308,7 +310,9 @@ static int reftable_writer_add_log_verbatim(struct reftable_writer *w,
308310
{
309311
struct reftable_record rec = {
310312
.type = BLOCK_TYPE_LOG,
311-
.u.log = *log,
313+
.u = {
314+
.log = *log,
315+
},
312316
};
313317
if (w->block_writer &&
314318
block_writer_type(w->block_writer) == BLOCK_TYPE_REF) {
@@ -401,7 +405,9 @@ static int writer_finish_section(struct reftable_writer *w)
401405
for (i = 0; i < idx_len; i++) {
402406
struct reftable_record rec = {
403407
.type = BLOCK_TYPE_INDEX,
404-
.u.idx = idx[i],
408+
.u = {
409+
.idx = idx[i],
410+
},
405411
};
406412
if (block_writer_add(w->block_writer, &rec) == 0) {
407413
continue;

0 commit comments

Comments
 (0)