netlogon_creds_cli: Avoid a static const struct
authorVolker Lendecke <vl@samba.org>
Fri, 25 Aug 2017 09:27:30 +0000 (11:27 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 16 Sep 2017 06:36:17 +0000 (08:36 +0200)
Same number of .text bytes, but simpler code.

Yes, this is {{0}} instead of {0}, which I always promote. I've just read a
comment on stackoverflow (which I've unfortunately just closed the tab for :-()
that {{0}} might actually be the correct way to init a struct to zero if the
first struct element is again a struct. I'm lost. 25 years of C coding and I
have no clue of the language :-(

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/auth/netlogon_creds_cli.c

index 6cf8242041aeeb5deb5bc2a147cac9eeb34dc175..2b238b701bc71493b3d6a32db2087b805b081ebb 100644 (file)
@@ -572,7 +572,6 @@ NTSTATUS netlogon_creds_cli_get(struct netlogon_creds_cli_context *context,
                .status = NT_STATUS_INTERNAL_ERROR,
                .required_flags = context->client.required_flags,
        };
-       static const struct netr_Credential zero_creds;
 
        *_creds = NULL;
 
@@ -592,9 +591,9 @@ NTSTATUS netlogon_creds_cli_get(struct netlogon_creds_cli_context *context,
         * mark it as invalid for step operations.
         */
        fstate.creds->sequence = 0;
-       fstate.creds->seed = zero_creds;
-       fstate.creds->client = zero_creds;
-       fstate.creds->server = zero_creds;
+       fstate.creds->seed = (struct netr_Credential) {{0}};
+       fstate.creds->client = (struct netr_Credential) {{0}};
+       fstate.creds->server = (struct netr_Credential) {{0}};
 
        if (context->server.cached_flags == fstate.creds->negotiate_flags) {
                *_creds = fstate.creds;