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

jelmer at samba.org jelmer at samba.org
Wed Jan 2 01:52:28 GMT 2008


Author: jelmer
Date: 2008-01-02 01:52:26 +0000 (Wed, 02 Jan 2008)
New Revision: 26641

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

Log:
ldb(Python): Remove some unnecessary {}'s.

Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/ldb/ldb.i
   branches/SAMBA_4_0/source/lib/ldb/ldb_wrap.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb.i
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb.i	2008-01-02 01:52:18 UTC (rev 26640)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb.i	2008-01-02 01:52:26 UTC (rev 26641)
@@ -106,7 +106,7 @@
 }
 
 #ifdef SWIGPYTHON
-%typemap(argout) struct ldb_result ** (int i) {
+%typemap(argout,noblock=1) struct ldb_result ** (int i) {
 	$result = PyList_New((*$1)->count);
     for (i = 0; i < (*$1)->count; i++) {
         PyList_SetItem($result, i, 
@@ -129,7 +129,7 @@
     }
 }
 
-%typemap(freearg) const char * const *attrs {
+%typemap(freearg,noblock=1) const char * const *attrs {
     talloc_free($1);
 }
 #endif
@@ -331,7 +331,6 @@
             return ret;
         }
         ~ldb_msg() { talloc_free($self); }
-
         ldb_msg_element *find_element(const char *name);
         
 #ifdef SWIGPYTHON
@@ -393,8 +392,7 @@
 }
 %}
 
-%typemap(in,numinputs=1) (void (*debug)(void *context, enum ldb_debug_level level, const char *fmt, va_list ap),
-                            void *context) {
+%typemap(in,numinputs=1,noblock=1) (void (*debug)(void *context, enum ldb_debug_level level, const char *fmt, va_list ap), void *context) {
     $1 = py_ldb_debug;
     /* FIXME: Should be decreased somewhere as well. Perhaps register a 
        destructor and tie it to the ldb context ? */
@@ -485,6 +483,7 @@
             PyObject *key, *value;
             ldb_msg_element *msgel;
             ldb_msg *msg = NULL;
+
             if (PyDict_Check(py_msg)) {
                 msg = ldb_msg_new(NULL);
                 msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_msg));
@@ -516,7 +515,7 @@
                     return LDB_ERR_OTHER;
             }
 
-            ret = ldb_add($self,msg);
+            ret = ldb_add($self, msg);
 
             talloc_free(msg);
             return ret;
@@ -542,9 +541,9 @@
         ldb_error transaction_cancel();
 
 #ifdef SWIGPYTHON
-        %typemap(in,numinputs=0) struct ldb_result **result_as_bool (struct ldb_result *tmp) { $1 = &tmp; }
-        %typemap(argout) struct ldb_result **result_as_bool { $result = ((*$1)->count > 0)?Py_True:Py_False; }
-        %typemap(freearg) struct ldb_result **result_as_bool { talloc_free(*$1); }
+        %typemap(in,numinputs=0,noblock=1) struct ldb_result **result_as_bool (struct ldb_result *tmp) { $1 = &tmp; }
+        %typemap(argout,noblock=1) struct ldb_result **result_as_bool { $result = ((*$1)->count > 0)?Py_True:Py_False; }
+        %typemap(freearg,noblock=1) struct ldb_result **result_as_bool { talloc_free(*$1); }
         ldb_error __contains__(ldb_dn *dn, struct ldb_result **result_as_bool)
         {
             return ldb_search($self, dn, LDB_SCOPE_BASE, NULL, NULL, 
@@ -597,7 +596,7 @@
 %rename(string_to_time) ldb_string_to_time;
 time_t ldb_string_to_time(const char *s);
 
-%typemap(in) const struct ldb_module_ops * {
+%typemap(in,noblock=1) const struct ldb_module_ops * {
     $1 = talloc_zero(talloc_autofree_context(), struct ldb_module_ops);
 
     $1->name = (char *)PyObject_GetAttrString($input, (char *)"name");

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_wrap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_wrap.c	2008-01-02 01:52:18 UTC (rev 26640)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_wrap.c	2008-01-02 01:52:26 UTC (rev 26641)
@@ -3040,6 +3040,7 @@
             PyObject *key, *value;
             ldb_msg_element *msgel;
             ldb_msg *msg = NULL;
+
             if (PyDict_Check(py_msg)) {
                 msg = ldb_msg_new(NULL);
                 msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_msg));
@@ -3071,7 +3072,7 @@
                     return 80;
             }
 
-            ret = ldb_add(self,msg);
+            ret = ldb_add(self, msg);
 
             talloc_free(msg);
             return ret;
@@ -4358,26 +4359,20 @@
     SWIG_fail;
   }
   resultobj = Py_None;
-  {
-    resultobj = PyList_New((*arg6)->count);
-    for (i6 = 0; i6 < (*arg6)->count; i6++) {
-      PyList_SetItem(resultobj, i6, 
-        SWIG_NewPointerObj((*arg6)->msgs[i6], SWIGTYPE_p_ldb_message, 0)
-        );
-    }
+  resultobj = PyList_New((*arg6)->count);
+  for (i6 = 0; i6 < (*arg6)->count; i6++) {
+    PyList_SetItem(resultobj, i6, 
+      SWIG_NewPointerObj((*arg6)->msgs[i6], SWIGTYPE_p_ldb_message, 0)
+      );
   }
   talloc_free(arg2);
   if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
-  {
-    talloc_free(arg5);
-  }
+  talloc_free(arg5);
   return resultobj;
 fail:
   talloc_free(arg2);
   if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
-  {
-    talloc_free(arg5);
-  }
+  talloc_free(arg5);
   return NULL;
 }
 
@@ -4833,13 +4828,11 @@
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_set_debug" "', argument " "1"" of type '" "ldb *""'"); 
   }
   arg1 = (ldb *)(argp1);
-  {
-    arg2 = py_ldb_debug;
-    /* FIXME: Should be decreased somewhere as well. Perhaps register a 
-           destructor and tie it to the ldb context ? */
-    Py_INCREF(obj1);
-    arg3 = obj1;
-  }
+  arg2 = py_ldb_debug;
+  /* FIXME: Should be decreased somewhere as well. Perhaps register a 
+         destructor and tie it to the ldb context ? */
+  Py_INCREF(obj1);
+  arg3 = obj1;
   if (arg1 == NULL)
   SWIG_exception(SWIG_ValueError, 
     "ldb context must be non-NULL");
@@ -5051,9 +5044,7 @@
     (char *) "self",(char *) "dn", NULL 
   };
   
-  {
-    arg3 = &tmp3; 
-  }
+  arg3 = &tmp3;
   if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb___contains__",kwnames,&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
@@ -5072,19 +5063,13 @@
     SWIG_fail;
   }
   resultobj = Py_None;
-  {
-    resultobj = ((*arg3)->count > 0)?Py_True:Py_False; 
-  }
+  resultobj = ((*arg3)->count > 0)?Py_True:Py_False;
   talloc_free(arg2);
-  {
-    talloc_free(*arg3); 
-  }
+  talloc_free(*arg3);
   return resultobj;
 fail:
   talloc_free(arg2);
-  {
-    talloc_free(*arg3); 
-  }
+  talloc_free(*arg3);
   return NULL;
 }
 
@@ -5231,11 +5216,9 @@
   };
   
   if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:register_module",kwnames,&obj0)) SWIG_fail;
-  {
-    arg1 = talloc_zero(talloc_autofree_context(), struct ldb_module_ops);
-    
-    arg1->name = (char *)PyObject_GetAttrString(obj0, (char *)"name");
-  }
+  arg1 = talloc_zero(talloc_autofree_context(), struct ldb_module_ops);
+  
+  arg1->name = (char *)PyObject_GetAttrString(obj0, (char *)"name");
   result = ldb_register_module((struct ldb_module_ops const *)arg1);
   if (result != 0) {
     PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_strerror(result)));



More information about the samba-cvs mailing list