diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-03-02 03:46:13 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-03-02 05:26:56 +0100 |
commit | ebe04fc652f78ccbf765d9afe1ecc67c5e302eed (patch) | |
tree | 4ad928847c98c063acf55070b56dffe62e4357f3 /lib/ldb | |
parent | fd7ba79abac41eee221c6e24c2a762e651a41d65 (diff) | |
download | samba-ebe04fc652f78ccbf765d9afe1ecc67c5e302eed.tar.gz |
pyldb: Fix some more long lines, fix formatting.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Fri Mar 2 05:26:56 CET 2012 on sn-devel-104
Diffstat (limited to 'lib/ldb')
-rw-r--r-- | lib/ldb/pyldb.c | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index a2a5dffd25f..ea7b695d6d7 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -707,16 +707,20 @@ static void py_ldb_debug(void *context, enum ldb_debug_level level, const char * PyObject_CallFunction(fn, discard_const_p(char, "(i,O)"), level, PyString_FromFormatV(fmt, ap)); } -static PyObject *py_ldb_set_debug(PyLdbObject *self, PyObject *args) +static PyObject *py_ldb_set_debug(PyObject *self, PyObject *args) { PyObject *cb; + struct ldb_context *ldb_ctx; if (!PyArg_ParseTuple(args, "O", &cb)) return NULL; Py_INCREF(cb); /* FIXME: Where do we DECREF cb ? */ - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), pyldb_Ldb_AsLdbContext(self)); + ldb_ctx = pyldb_Ldb_AsLdbContext(self); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, + ldb_set_debug(ldb_ctx, py_ldb_debug, cb), + ldb_ctx); Py_RETURN_NONE; } @@ -745,31 +749,46 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args) static PyObject *py_ldb_transaction_start(PyLdbObject *self) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_start(pyldb_Ldb_AsLdbContext(self)), pyldb_Ldb_AsLdbContext(self)); + struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + int ldb_err; + ldb_err = ldb_transaction_start(ldb_ctx); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); Py_RETURN_NONE; } static PyObject *py_ldb_transaction_commit(PyLdbObject *self) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_commit(pyldb_Ldb_AsLdbContext(self)), pyldb_Ldb_AsLdbContext(self)); + struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + int ldb_err; + ldb_err = ldb_transaction_commit(ldb_ctx); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); Py_RETURN_NONE; } static PyObject *py_ldb_transaction_prepare_commit(PyLdbObject *self) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_prepare_commit(pyldb_Ldb_AsLdbContext(self)), pyldb_Ldb_AsLdbContext(self)); + struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + int ldb_err; + ldb_err = ldb_transaction_prepare_commit(ldb_ctx); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); Py_RETURN_NONE; } static PyObject *py_ldb_transaction_cancel(PyLdbObject *self) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_cancel(pyldb_Ldb_AsLdbContext(self)), pyldb_Ldb_AsLdbContext(self)); + struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + int ldb_err; + ldb_err = ldb_transaction_cancel(ldb_ctx); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); Py_RETURN_NONE; } static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_setup_wellknown_attributes(pyldb_Ldb_AsLdbContext(self)), pyldb_Ldb_AsLdbContext(self)); + struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + int ldb_err; + ldb_err = ldb_setup_wellknown_attributes(ldb_ctx); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); Py_RETURN_NONE; } @@ -905,6 +924,7 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa int ret; const char **options; const char * const kwnames[] = { "url", "flags", "options", NULL }; + struct ldb_context *ldb_ctx; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zIO", discard_const_p(char *, kwnames), @@ -919,11 +939,11 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa return NULL; } - ret = ldb_connect(pyldb_Ldb_AsLdbContext(self), url, flags, options); + ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ret = ldb_connect(ldb_ctx, url, flags, options); talloc_free(options); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, - pyldb_Ldb_AsLdbContext(self)); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); Py_RETURN_NONE; } @@ -1145,7 +1165,7 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args, PyObject *kwargs) ret = ldb_request(ldb_ctx, req); if (ret == LDB_SUCCESS) { ret = ldb_wait(req->handle, LDB_WAIT_ALL); - } + } if (ret == LDB_SUCCESS) { ret = ldb_transaction_commit(ldb_ctx); @@ -1327,12 +1347,15 @@ static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args) char *attribute, *syntax; unsigned int flags; int ret; + struct ldb_context *ldb_ctx; + if (!PyArg_ParseTuple(args, "sIs", &attribute, &flags, &syntax)) return NULL; - ret = ldb_schema_attribute_add(pyldb_Ldb_AsLdbContext(self), attribute, flags, syntax); + ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ret = ldb_schema_attribute_add(ldb_ctx, attribute, flags, syntax); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, pyldb_Ldb_AsLdbContext(self)); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); Py_RETURN_NONE; } @@ -2004,7 +2027,7 @@ static PyObject *py_ldb_module_search(PyLdbModuleObject *self, PyObject *args, P talloc_free(req); - return py_ret; + return py_ret; } |