diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-07-11 06:51:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:55 -0500 |
commit | 30c15f37cc73f0beebceed009109542ba738d011 (patch) | |
tree | 7e269396f8af7bbb368288ad42b45ccdfb4e38ac /source4 | |
parent | 462d27d7e633e368928569f8fbe9e25ab3e72e1c (diff) | |
download | samba-30c15f37cc73f0beebceed009109542ba738d011.tar.gz samba-30c15f37cc73f0beebceed009109542ba738d011.tar.bz2 samba-30c15f37cc73f0beebceed009109542ba738d011.zip |
r1435: talloc_steal is very useful - add a function to do it with a DATA_BLOB
Andrew Bartlett
(This used to be commit 66d6e2611084d579a20833a4c0daa5d72ef9393c)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/data_blob.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/lib/data_blob.c b/source4/lib/data_blob.c index 3667d453b9..a6e6672b90 100644 --- a/source4/lib/data_blob.c +++ b/source4/lib/data_blob.c @@ -99,6 +99,21 @@ DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length) return blob; } +/** + * Steal a talloc'ed DATA_BLOB from one context to another + */ + +DATA_BLOB data_blob_talloc_steal(TALLOC_CTX *old_ctx, TALLOC_CTX *new_ctx, + DATA_BLOB *old) +{ + DATA_BLOB new; + new = *old; + new.data = talloc_steal(old_ctx, new_ctx, old->data); + if (new.data == NULL) { + smb_panic("data_blob_talloc_steal: talloc_steal failed.\n"); + } +} + /******************************************************************* free a data blob *******************************************************************/ |