Re: [PATCH v2 07/25] reftable: (de)serialization for the polymorphic record type.
- From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
- Date
- Aug 16, 2021, 21:54 UTC
- Message-ID
- <YRresPEnuv9EwBgS@carlos-mbp.lan>
- In-Reply-To
- <282d8e4d817f969a3c4d882cc833dd76f4451764.1629145036.git.gitgitgadget@gmail.com>
On Mon, Aug 16, 2021 at 08:16:58PM +0000, Han-Wen Nienhuys via GitGitGadget wrote:
> From: Han-Wen Nienhuys <hanwen@google.com>
...
Show 11 quoted lines
> + union {
> + struct {
> + uint8_t *new_hash;
> + uint8_t *old_hash;
> + char *name;
> + char *email;
> + uint64_t time;
> + int16_t tz_offset;
> + char *message;
> + } update;
> + };the use of an anonymous union here (which requires C11) could be made C89 compatible without any impact AFAIK by doing instead:
diff --git a/reftable/reftable-record.h b/reftable/reftable-record.h index 7985b94ae2..136ff24910 100644 --- a/reftable/reftable-record.h +++ b/reftable/reftable-record.h @@ -84,17 +84,15 @@ struct reftable_log_record { #define REFTABLE_NR_LOG_VALUETYPES 2 } value_type; - union { - struct { - uint8_t *new_hash; - uint8_t *old_hash; - char *name; - char *email; - uint64_t time; - int16_t tz_offset; - char *message; - } update; - }; + struct { + uint8_t *new_hash; + uint8_t *old_hash; + char *name; + char *email; + uint64_t time; + int16_t tz_offset; + char *message; + } update; }; /* returns whether 'ref' represents the deletion of a log record. */