diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-09-20 07:15:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:00:49 -0500 |
commit | f7a93b6acb705256c2aa4fe6475b89223af30491 (patch) | |
tree | 838435ab1896e3e901b7a51847cafb9b6e5f4652 /source | |
parent | b0bb364df0efe140780328d90ae55bb823e6b10d (diff) | |
download | samba-f7a93b6acb705256c2aa4fe6475b89223af30491.tar.gz samba-f7a93b6acb705256c2aa4fe6475b89223af30491.tar.xz samba-f7a93b6acb705256c2aa4fe6475b89223af30491.zip |
r18709: add some useful function from samba4
metze
Diffstat (limited to 'source')
-rw-r--r-- | source/lib/data_blob.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/lib/data_blob.c b/source/lib/data_blob.c index 4d5dda24359..c7eadc1acfb 100644 --- a/source/lib/data_blob.c +++ b/source/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; +} |