From: Volker Lendecke Date: Sat, 31 Dec 2016 12:45:51 +0000 (+0000) Subject: librpc: Use "all_zero" where appropriate X-Git-Tag: samba-4.6.0rc1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f46932abfcd6461f4aa61302312ba13f641fc3d7;p=thirdparty%2Fsamba.git librpc: Use "all_zero" where appropriate ... Saves a few bytes of footprint Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c index ea082d148dd..ecc05115d4b 100644 --- a/librpc/ndr/ndr_sec_helper.c +++ b/librpc/ndr/ndr_sec_helper.c @@ -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; }