diff options
author | Tim Potter <tpot@samba.org> | 2006-04-16 03:46:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:04:08 -0500 |
commit | 3f52210e7bda5ef596d172c84d9b5754f0c40438 (patch) | |
tree | 1115676dbaacbedadb7c15ac166ce16d1463ff38 /source4/lib/ldb/swig | |
parent | aa8ced45126c1aa44200bcaf05b51ddd194ea70f (diff) | |
download | samba-3f52210e7bda5ef596d172c84d9b5754f0c40438.tar.gz samba-3f52210e7bda5ef596d172c84d9b5754f0c40438.tar.bz2 samba-3f52210e7bda5ef596d172c84d9b5754f0c40438.zip |
r15095: Fix up typemap for struct ldb_val so that ldb_msg_add_value() wrapper
works properly.
(This used to be commit 75176b188bfd5008775365110f8ed15dd00e0b50)
Diffstat (limited to 'source4/lib/ldb/swig')
-rw-r--r-- | source4/lib/ldb/swig/ldb.i | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/source4/lib/ldb/swig/ldb.i b/source4/lib/ldb/swig/ldb.i index 67c644b4f8..008969a557 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); |