rpc_client: Save a few lines with direct struct initialization
authorVolker Lendecke <vl@samba.org>
Sat, 6 Feb 2021 07:32:36 +0000 (08:32 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 9 Mar 2021 22:36:28 +0000 (22:36 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_client/cli_lsarpc.c

index 8f064f64a6c0b2d94a31baaab0d245823772cd44..1ea49781a4d8204c63b9a924a60c53c700f64317 100644 (file)
@@ -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;