Re: [PATCH 06/22] Get rid of C-style memset initializations, use C++ style aggregates

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

 



On Thu, Mar 01, 2018 at 09:01:37PM +0100, Christophe de Dinechin wrote:
> > On 28 Feb 2018, at 17:36, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
> > 
> > My understanding is that the previous iteration was quite controversial,
> > I would just drop it from the series unless you get acks from everyone
> > involved this time.
> 
> It’s a bit difficult to drop that from the series, as it is a core element of the next steps if you look carefully.

I only looked at the code with the full series applied, but it really seems like both way would
be possible?

diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
index fe8564f..2e1472a 100644
--- a/src/concrete-agent.cpp
+++ b/src/concrete-agent.cpp
@@ -140,7 +140,10 @@ public:
     }
     void write_message_body(Stream &stream, unsigned w, unsigned h, uint8_t c)
     {
-        StreamMsgFormat msg = { .width = w, .height = h, .codec = c, .padding1 = {} };
+        StreamMsgFormat msg;
+        msg.width = w;
+        msg.height = h;
+        msg.codec = c;
         stream.write_all("format", &msg, sizeof(msg));
     }
 };
diff --git a/src/message.hpp b/src/message.hpp
index fd69033..674e122 100644
--- a/src/message.hpp
+++ b/src/message.hpp
@@ -21,13 +21,12 @@ class Message
 public:
     template <typename ...PayloadArgs>
     Message(PayloadArgs... payload_args)
-        : hdr(StreamDevHeader {
-              .protocol_version = STREAM_DEVICE_PROTOCOL,
-              .padding = 0,     // Workaround GCC bug "sorry: not implemented"
-              .type = Type,
-              .size = (uint32_t) Info::size(payload_args...)
-          })
-    { }
+    {
+        hdr.protocol_version = STREAM_DEVICE_PROTOCOL;
+        hdr.padding = 0;
+        hdr.type = Type;
+        hdr.size = (uint32_t) Info::size(payload_args...);
+    }
     void write_header(Stream &stream)
     {
         stream.write_all("header", &hdr, sizeof(hdr));

Not strongly advocating for that change to be made just now, I was just
a bit surprised by how you dismissed this ;)

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]