From fbcd912bb6114d203a8645e9aec1c6134e9ebf3f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 7 Aug 2014 09:51:57 +0200 Subject: [PATCH] s3:messaging: use struct initializers for 'struct messaging_rec' This makes sure new struct members will always be initialized, without explicitly finding all users. Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- source3/lib/messages.c | 13 ++++++++----- source3/lib/messages_ctdbd.c | 14 +++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/source3/lib/messages.c b/source3/lib/messages.c index 52d6538542f..0e0259236ed 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -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; diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c index add089da38b..9c13260173c 100644 --- a/source3/lib/messages_ctdbd.c +++ b/source3/lib/messages_ctdbd.c @@ -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); -- 2.11.4.GIT