From: Volker Lendecke Date: Sat, 6 Feb 2021 07:32:36 +0000 (+0100) Subject: rpc_client: Save a few lines with direct struct initialization X-Git-Tag: tevent-0.11.0~1626 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49efd6113b6e30ccc66d202d54b562055efe6d45;p=thirdparty%2Fsamba.git rpc_client: Save a few lines with direct struct initialization Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 8f064f64a6c..1ea49781a4d 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -50,14 +50,10 @@ NTSTATUS dcerpc_lsa_open_policy(struct dcerpc_binding_handle *h, struct policy_handle *pol, NTSTATUS *result) { - struct lsa_ObjectAttribute attr; + struct lsa_ObjectAttribute attr = { .len = 0x18, }; struct lsa_QosInfo qos; uint16_t system_name = '\\'; - ZERO_STRUCT(attr); - - attr.len = 0x18; - if (sec_qos) { qos.len = 0xc; qos.impersonation_level = 2; @@ -109,13 +105,9 @@ NTSTATUS dcerpc_lsa_open_policy2(struct dcerpc_binding_handle *h, struct policy_handle *pol, NTSTATUS *result) { - struct lsa_ObjectAttribute attr; + struct lsa_ObjectAttribute attr = { .len = 0x18, }; struct lsa_QosInfo qos; - ZERO_STRUCT(attr); - - attr.len = 0x18; - if (sec_qos) { qos.len = 0xc; qos.impersonation_level = 2; @@ -183,12 +175,10 @@ static NTSTATUS dcerpc_lsa_lookup_sids_noalloc(struct dcerpc_binding_handle *h, NTSTATUS result = NT_STATUS_UNSUCCESSFUL; struct lsa_SidArray sid_array; struct lsa_RefDomainList *ref_domains = NULL; - struct lsa_TransNameArray lsa_names; + struct lsa_TransNameArray lsa_names = { .count = 0, }; uint32_t count = 0; int i; - ZERO_STRUCT(lsa_names); - sid_array.num_sids = num_sids; sid_array.sids = talloc_array(mem_ctx, struct lsa_SidPtr, num_sids); if (sid_array.sids == NULL) { @@ -580,14 +570,11 @@ NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h, NTSTATUS status; struct lsa_String *lsa_names = NULL; struct lsa_RefDomainList *domains = NULL; - struct lsa_TransSidArray sid_array; - struct lsa_TransSidArray3 sid_array3; + struct lsa_TransSidArray sid_array = { .count = 0, }; + struct lsa_TransSidArray3 sid_array3 = { .count = 0, }; uint32_t count = 0; uint32_t i; - ZERO_STRUCT(sid_array); - ZERO_STRUCT(sid_array3); - lsa_names = talloc_array(mem_ctx, struct lsa_String, num_names); if (lsa_names == NULL) { return NT_STATUS_NO_MEMORY;