Re: [PATCH v2 07/25] reftable: (de)serialization for the polymorphic record type.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 16, 2021 at 08:16:58PM +0000, Han-Wen Nienhuys via GitGitGadget wrote:
> From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx>
...
> +	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. */



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux