s3:messaging: use struct initializers for 'struct messaging_rec'
authorStefan Metzmacher <metze@samba.org>
Thu, 7 Aug 2014 07:51:57 +0000 (09:51 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 24 Sep 2014 06:44:11 +0000 (08:44 +0200)
This makes sure new struct members will always be initialized,
without explicitly finding all users.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/lib/messages.c
source3/lib/messages_ctdbd.c

index 52d6538542fb165b0a17aeee34999846ba4f6276..0e0259236ed82f103375e7fb92c3712a15b26287 100644 (file)
@@ -466,11 +466,14 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
                        return NT_STATUS_NO_MEMORY;
                }
 
-               rec.msg_version = MESSAGE_VERSION;
-               rec.msg_type = msg_type & MSG_TYPE_MASK;
-               rec.dest = server;
-               rec.src = msg_ctx->id;
-               rec.buf = data_blob_const(buf, talloc_get_size(buf));
+               rec = (struct messaging_rec) {
+                       .msg_version = MESSAGE_VERSION,
+                       .msg_type = msg_type & MSG_TYPE_MASK,
+                       .dest = server,
+                       .src = msg_ctx->id,
+                       .buf = data_blob_const(buf, talloc_get_size(buf)),
+               };
+
                messaging_dispatch_rec(msg_ctx, &rec);
                TALLOC_FREE(buf);
                return NT_STATUS_OK;
index add089da38b48306bae1bcb5f8e1522330bc9d27..9c13260173c19a24c19f18fbb0bd5090cba2b465 100644 (file)
@@ -95,7 +95,6 @@ static int messaging_ctdb_send(struct server_id src,
 {
        struct messaging_ctdbd_context *ctx = talloc_get_type_abort(
                backend->private_data, struct messaging_ctdbd_context);
-
        struct messaging_rec msg;
        uint8_t *buf;
        NTSTATUS status;
@@ -105,12 +104,13 @@ static int messaging_ctdb_send(struct server_id src,
                return ENOMEM;
        }
 
-
-       msg.msg_version = MESSAGE_VERSION;
-       msg.msg_type    = msg_type;
-       msg.dest        = pid;
-       msg.src         = src;
-       msg.buf         = data_blob_const(buf, talloc_get_size(buf));
+       msg = (struct messaging_rec) {
+               .msg_version    = MESSAGE_VERSION,
+               .msg_type       = msg_type,
+               .dest           = pid,
+               .src            = src,
+               .buf            = data_blob_const(buf, talloc_get_size(buf)),
+       };
 
        status = ctdbd_messaging_send(ctx->conn, pid.vnn, pid.pid, &msg);