summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-09-20 07:15:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:00:49 -0500
commit2fb8589862506d8a325f85c6c7d67509fe149d48 (patch)
tree79c648b4028d7b06e64c6dee6604b09d9252e7b0 /source3
parenta62f996c5a898dc2559136530dbba2089ad9fd16 (diff)
downloadsamba-2fb8589862506d8a325f85c6c7d67509fe149d48.tar.gz
samba-2fb8589862506d8a325f85c6c7d67509fe149d48.tar.bz2
samba-2fb8589862506d8a325f85c6c7d67509fe149d48.zip
r18709: add some useful function from samba4
metze (This used to be commit f7a93b6acb705256c2aa4fe6475b89223af30491)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/data_blob.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c
index 4d5dda2435..c7eadc1acf 100644
--- a/source3/lib/data_blob.c
+++ b/source3/lib/data_blob.c
@@ -118,3 +118,28 @@ void data_blob_clear_free(DATA_BLOB *d)
data_blob_clear(d);
data_blob_free(d);
}
+
+/**
+ useful for constructing data blobs in test suites, while
+ avoiding const warnings
+**/
+DATA_BLOB data_blob_string_const(const char *str)
+{
+ DATA_BLOB blob;
+ blob.data = CONST_DISCARD(uint8 *, str);
+ blob.length = strlen(str);
+ blob.free = NULL;
+ return blob;
+}
+
+/**
+ * Create a new data blob from const data
+ */
+DATA_BLOB data_blob_const(const void *p, size_t length)
+{
+ DATA_BLOB blob;
+ blob.data = CONST_DISCARD(uint8 *, p);
+ blob.length = length;
+ blob.free = NULL;
+ return blob;
+}