summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-04-04 10:56:22 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-04-04 10:56:22 -0700
commit259ec8f5b95c1a2a5cb295a05c80be441f15ad6c (patch)
tree01a24d8a46374e42c3ba2d2b5e626b03bf5bcae6
parentMerge branch 'gc/submodule-update-part2' (diff)
parentreftable: make assignments portable to AIX xlc v12.01 (diff)
downloadtgif-259ec8f5b95c1a2a5cb295a05c80be441f15ad6c.tar.xz
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
-rw-r--r--reftable/generic.c8
-rw-r--r--reftable/record_test.c4
-rw-r--r--reftable/writer.c12
3 files changed, 18 insertions, 6 deletions
diff --git a/reftable/generic.c b/reftable/generic.c
index b27d152e89..57f8032db9 100644
--- a/reftable/generic.c
+++ b/reftable/generic.c
@@ -130,7 +130,9 @@ int reftable_iterator_next_ref(struct reftable_iterator *it,
{
struct reftable_record rec = {
.type = BLOCK_TYPE_REF,
- .u.ref = *ref,
+ .u = {
+ .ref = *ref
+ },
};
int err = iterator_next(it, &rec);
*ref = rec.u.ref;
@@ -142,7 +144,9 @@ int reftable_iterator_next_log(struct reftable_iterator *it,
{
struct reftable_record rec = {
.type = BLOCK_TYPE_LOG,
- .u.log = *log,
+ .u = {
+ .log = *log,
+ },
};
int err = iterator_next(it, &rec);
*log = rec.u.log;
diff --git a/reftable/record_test.c b/reftable/record_test.c
index f91ea5e883..70ae78feca 100644
--- a/reftable/record_test.c
+++ b/reftable/record_test.c
@@ -339,7 +339,9 @@ static void test_reftable_obj_record_roundtrip(void)
};
struct reftable_record in = {
.type = BLOCK_TYPE_OBJ,
- .u.obj = recs[i],
+ .u = {
+ .obj = recs[i],
+ },
};
struct strbuf key = STRBUF_INIT;
struct reftable_record out = { .type = BLOCK_TYPE_OBJ };
diff --git a/reftable/writer.c b/reftable/writer.c
index 6d979e245f..427f1317c6 100644
--- a/reftable/writer.c
+++ b/reftable/writer.c
@@ -257,7 +257,9 @@ int reftable_writer_add_ref(struct reftable_writer *w,
{
struct reftable_record rec = {
.type = BLOCK_TYPE_REF,
- .u.ref = *ref,
+ .u = {
+ .ref = *ref
+ },
};
int err = 0;
@@ -308,7 +310,9 @@ static int reftable_writer_add_log_verbatim(struct reftable_writer *w,
{
struct reftable_record rec = {
.type = BLOCK_TYPE_LOG,
- .u.log = *log,
+ .u = {
+ .log = *log,
+ },
};
if (w->block_writer &&
block_writer_type(w->block_writer) == BLOCK_TYPE_REF) {
@@ -401,7 +405,9 @@ static int writer_finish_section(struct reftable_writer *w)
for (i = 0; i < idx_len; i++) {
struct reftable_record rec = {
.type = BLOCK_TYPE_INDEX,
- .u.idx = idx[i],
+ .u = {
+ .idx = idx[i],
+ },
};
if (block_writer_add(w->block_writer, &rec) == 0) {
continue;