summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2019-02-13 10:38:02 +0100
committerKarolin Seeger <kseeger@samba.org>2019-02-21 12:30:45 +0100
commitf6a44c807a9cf9061ab82930c7b0799c785ff6b2 (patch)
tree213d3e115e9f15b64349a2eac36177f07c2ca9ac
parent2ba1d9dd8d2ab2b11e13a1e1355cbc391226e084 (diff)
downloadsamba-f6a44c807a9cf9061ab82930c7b0799c785ff6b2.tar.gz
librpc:ndr: Add NDR_ZERO_STRUCT(P) macros
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 666802a3db3115ca09f3ffed58c8e4a8cabd65de)
-rw-r--r--librpc/ndr/libndr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 1f0f3c227cf..9c403319b6e 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -411,6 +411,13 @@ enum ndr_compression_alg {
if (unlikely(!(s))) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %s failed: %s\n", # s, __location__); \
} while (0)
+#define NDR_ZERO_STRUCT(x) ndr_zero_memory(&(x), sizeof(x))
+#define NDR_ZERO_STRUCTP(x) do { \
+ if ((x) != NULL) { \
+ ndr_zero_memory((x), sizeof(*(x))); \
+ } \
+} while(0)
+
/* these are used when generic fn pointers are needed for ndr push/pull fns */
typedef enum ndr_err_code (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);
typedef enum ndr_err_code (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);