Merge data_blob_talloc_zero() from samba4.
authorGünther Deschner <gd@samba.org>
Wed, 13 Feb 2008 09:19:06 +0000 (10:19 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 13 Feb 2008 09:20:10 +0000 (10:20 +0100)
Guenther
(This used to be commit 9fca3ca37eaf10c24f852e854dd28b7155c3e536)

source3/lib/data_blob.c

index 8bbbc32d7b1d62d9481ef8bfc8a0b5fbca520f23..daba17df14801ae8f4bbe6ef7656de665d6d7e4f 100644 (file)
@@ -144,3 +144,15 @@ DATA_BLOB data_blob_const(const void *p, size_t length)
        blob.free = NULL;
        return blob;
 }
+
+/**
+ construct a zero data blob, using supplied TALLOC_CTX.
+ use this sparingly as it initialises data - better to initialise
+ yourself if you want specific data in the blob
+**/
+DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length)
+{
+       DATA_BLOB blob = data_blob_talloc(mem_ctx, NULL, length);
+       data_blob_clear(&blob);
+       return blob;
+}