svn commit: samba r15095 - in branches/SAMBA_4_0/source/lib/ldb/swig: .

tpot at samba.org tpot at samba.org
Sun Apr 16 03:46:06 GMT 2006


Author: tpot
Date: 2006-04-16 03:46:05 +0000 (Sun, 16 Apr 2006)
New Revision: 15095

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15095

Log:
Fix up typemap for struct ldb_val so that ldb_msg_add_value() wrapper 
works properly.

Modified:
   branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i	2006-04-15 21:24:32 UTC (rev 15094)
+++ branches/SAMBA_4_0/source/lib/ldb/swig/ldb.i	2006-04-16 03:46:05 UTC (rev 15095)
@@ -45,6 +45,15 @@
 %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 @@
  * 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 @@
 	$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 @@
 
 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);



More information about the samba-cvs mailing list