From 3f52210e7bda5ef596d172c84d9b5754f0c40438 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 16 Apr 2006 03:46:05 +0000 Subject: [PATCH] r15095: Fix up typemap for struct ldb_val so that ldb_msg_add_value() wrapper works properly. (This used to be commit 75176b188bfd5008775365110f8ed15dd00e0b50) --- source4/lib/ldb/swig/ldb.i | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/source4/lib/ldb/swig/ldb.i b/source4/lib/ldb/swig/ldb.i index 67c644b4f8f..008969a5574 100644 --- a/source4/lib/ldb/swig/ldb.i +++ b/source4/lib/ldb/swig/ldb.i @@ -45,6 +45,15 @@ typedef long long int64_t; %include "carrays.i" %include "exception.i" +/* + * Constants + */ + +enum ldb_scope {LDB_SCOPE_DEFAULT=-1, + LDB_SCOPE_BASE=0, + LDB_SCOPE_ONELEVEL=1, + LDB_SCOPE_SUBTREE=2}; + /* * Wrap struct ldb_context */ @@ -72,7 +81,7 @@ int talloc_free(TALLOC_CTX *ptr); * Wrap struct ldb_val */ -%typemap(in) struct ldb_val * (struct ldb_val temp) { +%typemap(in) struct ldb_val *INPUT (struct ldb_val temp) { $1 = &temp; if (!PyString_Check($input)) { PyErr_SetString(PyExc_TypeError, "string arg expected"); @@ -82,20 +91,10 @@ int talloc_free(TALLOC_CTX *ptr); $1->data = PyString_AsString($input); } -%typemap(out) struct ldb_val * { - if ($1->data == NULL && $1->length == 0) { - Py_INCREF(Py_None); - $result = Py_None; - } else { - $result = PyString_FromStringAndSize($1->data, $1->length); - } +%typemap(out) struct ldb_val { + $result = PyString_FromStringAndSize($1.data, $1.length); } -enum ldb_scope {LDB_SCOPE_DEFAULT=-1, - LDB_SCOPE_BASE=0, - LDB_SCOPE_ONELEVEL=1, - LDB_SCOPE_SUBTREE=2}; - /* * Wrap struct ldb_result */ @@ -169,4 +168,4 @@ int ldb_add(struct ldb_context *ldb, const struct ldb_message *message); struct ldb_message *ldb_msg_new(void *mem_ctx); struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, const char *attr_name); -int ldb_msg_add_value(struct ldb_message *msg, const char *attr_name, const struct ldb_val *val); +int ldb_msg_add_value(struct ldb_message *msg, const char *attr_name, const struct ldb_val *INPUT); -- 2.34.1