[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Tue May 18 13:59:39 MDT 2010
The branch, master has been updated
via 829c876... Change data_blob() to be based on top of data_blob_talloc(), instead of the reverse (as it is now).
from f6f3bb1... s3-passdb: move get_logon_hours_from_pdb() into samr server.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 829c87634b2aca87789371ad33231e9d4bc518a8
Author: Jeremy Allison <jra at samba.org>
Date: Tue May 18 09:57:29 2010 -0700
Change data_blob() to be based on top of data_blob_talloc(), instead of the reverse (as it is now).
It makes no sense to talloc off the null context, then talloc steal
into the required context - just talloc off the correct context, and
change data_blob() to pass in the null context to data_blob_talloc().
Jeremy.
Signed-off-by: Günther Deschner <gd at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/util/data_blob.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/data_blob.c b/lib/util/data_blob.c
index 3448e94..10864a0 100644
--- a/lib/util/data_blob.c
+++ b/lib/util/data_blob.c
@@ -33,6 +33,14 @@ const DATA_BLOB data_blob_null = { NULL, 0 };
**/
_PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *name)
{
+ return data_blob_talloc_named(NULL, p, length, name);
+}
+
+/**
+ construct a data blob, using supplied TALLOC_CTX
+**/
+_PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t length, const char *name)
+{
DATA_BLOB ret;
if (p == NULL && length == 0) {
@@ -41,9 +49,9 @@ _PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *nam
}
if (p) {
- ret.data = (uint8_t *)talloc_memdup(NULL, p, length);
+ ret.data = (uint8_t *)talloc_memdup(mem_ctx, p, length);
} else {
- ret.data = talloc_array(NULL, uint8_t, length);
+ ret.data = talloc_array(mem_ctx, uint8_t, length);
}
if (ret.data == NULL) {
ret.length = 0;
@@ -55,19 +63,6 @@ _PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *nam
}
/**
- construct a data blob, using supplied TALLOC_CTX
-**/
-_PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t length, const char *name)
-{
- DATA_BLOB ret = data_blob_named(p, length, name);
-
- if (ret.data) {
- talloc_steal(mem_ctx, ret.data);
- }
- return ret;
-}
-
-/**
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
--
Samba Shared Repository
More information about the samba-cvs
mailing list