librpc: Use "all_zero" where appropriate
authorVolker Lendecke <vl@samba.org>
Sat, 31 Dec 2016 12:45:51 +0000 (12:45 +0000)
committerRalph Boehme <slow@samba.org>
Tue, 3 Jan 2017 15:04:28 +0000 (16:04 +0100)
... Saves a few bytes of footprint

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
librpc/ndr/ndr_sec_helper.c

index ea082d148dd26eec25a7b94eca6f0eebea5bee78..ecc05115d4b114f9587e551a318ed35fee1b194b 100644 (file)
@@ -128,13 +128,9 @@ size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
 
 size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
 {
-       struct dom_sid zero_sid;
-
        if (!sid) return 0;
 
-       ZERO_STRUCT(zero_sid);
-
-       if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+       if (all_zero((const uint8_t *)sid, sizeof(struct dom_sid))) {
                return 0;
        }
 
@@ -287,8 +283,6 @@ enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct
 */
 enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
 {
-       struct dom_sid zero_sid;
-
        if (!(ndr_flags & NDR_SCALARS)) {
                return NDR_ERR_SUCCESS;
        }
@@ -297,9 +291,7 @@ enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const s
                return NDR_ERR_SUCCESS;
        }
 
-       ZERO_STRUCT(zero_sid);
-
-       if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+       if (all_zero((const uint8_t *)sid, sizeof(struct dom_sid))) {
                return NDR_ERR_SUCCESS;
        }