diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-01-06 04:13:57 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-01-06 04:13:57 +0100 |
commit | d2c70d24e12293d9b4272eb310a6a4c4582b2d92 (patch) | |
tree | 5cc5f08da2608a20e2f961b7fecdd50e9752ec50 /source4/lib | |
parent | 1f8b6238dd161d29ee92902ea006158e180fa87b (diff) | |
download | samba-d2c70d24e12293d9b4272eb310a6a4c4582b2d92.tar.gz samba-d2c70d24e12293d9b4272eb310a6a4c4582b2d92.tar.bz2 samba-d2c70d24e12293d9b4272eb310a6a4c4582b2d92.zip |
py: Properly increase the reference counter of Py_None.
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/com/pycom.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/pyldb.c | 72 | ||||
-rw-r--r-- | source4/lib/messaging/pymessaging.c | 8 | ||||
-rw-r--r-- | source4/lib/registry/pyregistry.c | 18 |
4 files changed, 50 insertions, 50 deletions
diff --git a/source4/lib/com/pycom.c b/source4/lib/com/pycom.c index 9222be438d..55f1fd21be 100644 --- a/source4/lib/com/pycom.c +++ b/source4/lib/com/pycom.c @@ -56,7 +56,7 @@ static PyObject *py_get_class_object(PyObject *self, PyObject *args) /* FIXME: Magic, integrate with stubs generated by pidl. */ - return Py_None; + Py_RETURN_NONE; } static struct PyMethodDef com_methods[] = { diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 0dda9aa05b..0bc644716d 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -101,7 +101,7 @@ static PyObject *PyLdbResult_FromResult(struct ldb_result *result) PyObject *ret; int i; if (result == NULL) { - return Py_None; + Py_RETURN_NONE; } ret = PyList_New(result->count); for (i = 0; i < result->count; i++) { @@ -370,7 +370,7 @@ static PyObject *py_ldb_set_debug(PyLdbObject *self, PyObject *args) /* FIXME: Where do we DECREF cb ? */ PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_set_create_perms(PyTypeObject *self, PyObject *args) @@ -381,7 +381,7 @@ static PyObject *py_ldb_set_create_perms(PyTypeObject *self, PyObject *args) ldb_set_create_perms(PyLdb_AsLdbContext(self), perms); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args) @@ -392,31 +392,31 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args) ldb_set_modules_dir(PyLdb_AsLdbContext(self), modules_dir); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_transaction_start(PyLdbObject *self) { PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_start(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_transaction_commit(PyLdbObject *self) { PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_commit(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_transaction_cancel(PyLdbObject *self) { PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_cancel(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self) { PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_setup_wellknown_attributes(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_repr(PyLdbObject *self) @@ -428,7 +428,7 @@ static PyObject *py_ldb_get_root_basedn(PyLdbObject *self) { struct ldb_dn *dn = ldb_get_root_basedn(PyLdb_AsLdbContext(self)); if (dn == NULL) - return Py_None; + Py_RETURN_NONE; return PyLdbDn_FromDn(dn); } @@ -437,7 +437,7 @@ static PyObject *py_ldb_get_schema_basedn(PyLdbObject *self) { struct ldb_dn *dn = ldb_get_schema_basedn(PyLdb_AsLdbContext(self)); if (dn == NULL) - return Py_None; + Py_RETURN_NONE; return PyLdbDn_FromDn(dn); } @@ -446,7 +446,7 @@ static PyObject *py_ldb_get_config_basedn(PyLdbObject *self) { struct ldb_dn *dn = ldb_get_config_basedn(PyLdb_AsLdbContext(self)); if (dn == NULL) - return Py_None; + Py_RETURN_NONE; return PyLdbDn_FromDn(dn); } @@ -455,7 +455,7 @@ static PyObject *py_ldb_get_default_basedn(PyLdbObject *self) { struct ldb_dn *dn = ldb_get_default_basedn(PyLdb_AsLdbContext(self)); if (dn == NULL) - return Py_None; + Py_RETURN_NONE; return PyLdbDn_FromDn(dn); } @@ -560,7 +560,7 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args) @@ -578,7 +578,7 @@ static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args) ret = ldb_modify(PyLdb_AsLdbContext(self), PyLdbMessage_AsMessage(py_msg)); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args) @@ -635,7 +635,7 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args) ret = ldb_add(PyLdb_AsLdbContext(self), msg); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } @@ -657,7 +657,7 @@ static PyObject *py_ldb_delete(PyLdbObject *self, PyObject *args) ret = ldb_delete(ldb, dn); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args) @@ -679,7 +679,7 @@ static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args) ret = ldb_rename(ldb, dn1, dn2); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_schema_attribute_remove(PyLdbObject *self, PyObject *args) @@ -690,7 +690,7 @@ static PyObject *py_ldb_schema_attribute_remove(PyLdbObject *self, PyObject *arg ldb_schema_attribute_remove(PyLdb_AsLdbContext(self), name); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args) @@ -705,13 +705,13 @@ static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args) PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *ldb_ldif_to_pyobject(struct ldb_ldif *ldif) { if (ldif == NULL) { - return Py_None; + Py_RETURN_NONE; } else { /* We don't want this attached to the 'ldb' any more */ talloc_steal(NULL, ldif); @@ -758,12 +758,12 @@ static PyObject *py_ldb_schema_format_value(PyLdbObject *self, PyObject *args) a = ldb_schema_attribute_by_name(PyLdb_AsLdbContext(self), element_name); if (a == NULL) { - return Py_None; + Py_RETURN_NONE; } if (a->syntax->ldif_write_fn(PyLdb_AsLdbContext(self), mem_ctx, &old_val, &new_val) != 0) { talloc_free(mem_ctx); - return Py_None; + Py_RETURN_NONE; } ret = PyString_FromStringAndSize((const char *)new_val.data, new_val.length); @@ -862,7 +862,7 @@ static PyObject *py_ldb_get_opaque(PyLdbObject *self, PyObject *args) data = ldb_get_opaque(PyLdb_AsLdbContext(self), name); if (data == NULL) - return Py_None; + Py_RETURN_NONE; /* FIXME: More interpretation */ @@ -881,7 +881,7 @@ static PyObject *py_ldb_set_opaque(PyLdbObject *self, PyObject *args) ldb_set_opaque(PyLdb_AsLdbContext(self), name, data); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_modules(PyLdbObject *self) @@ -1077,19 +1077,19 @@ static PyObject *py_ldb_module_str(PyLdbModuleObject *self) static PyObject *py_ldb_module_start_transaction(PyLdbModuleObject *self) { PyLdbModule_AsModule(self)->ops->start_transaction(PyLdbModule_AsModule(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_module_end_transaction(PyLdbModuleObject *self) { PyLdbModule_AsModule(self)->ops->end_transaction(PyLdbModule_AsModule(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_module_del_transaction(PyLdbModuleObject *self) { PyLdbModule_AsModule(self)->ops->del_transaction(PyLdbModule_AsModule(self)); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_module_search(PyLdbModuleObject *self, PyObject *args, PyObject *kwargs) @@ -1138,7 +1138,7 @@ static PyObject *py_ldb_module_add(PyLdbModuleObject *self, PyObject *args) PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args) @@ -1160,7 +1160,7 @@ static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args) PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args) @@ -1180,7 +1180,7 @@ static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args) PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args) @@ -1202,7 +1202,7 @@ static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args) PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL); - return Py_None; + Py_RETURN_NONE; } static PyMethodDef py_ldb_module_methods[] = { @@ -1295,7 +1295,7 @@ static PyObject *py_ldb_msg_element_get(PyLdbMessageElementObject *self, PyObjec if (!PyArg_ParseTuple(args, "i", &i)) return NULL; if (i < 0 || i >= PyLdbMessageElement_AsMessageElement(self)->num_values) - return Py_None; + Py_RETURN_NONE; return PyObject_FromLdbValue(NULL, PyLdbMessageElement_AsMessageElement(self), &(PyLdbMessageElement_AsMessageElement(self)->values[i])); @@ -1434,7 +1434,7 @@ static PyObject *py_ldb_msg_element_str(PyLdbMessageElementObject *self) if (el->num_values == 1) return PyString_FromStringAndSize((char *)el->values[0].data, el->values[0].length); else - return Py_None; + Py_RETURN_NONE; } static void py_ldb_msg_element_dealloc(PyLdbMessageElementObject *self) @@ -1465,7 +1465,7 @@ static PyObject *py_ldb_msg_remove_attr(PyLdbMessageObject *self, PyObject *args ldb_msg_remove_attr(self->msg, name); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self) @@ -1516,7 +1516,7 @@ static PyObject *py_ldb_msg_get(PyLdbMessageObject *self, PyObject *args) ret = py_ldb_msg_getitem_helper(self, name); if (ret == NULL) - return Py_None; + Py_RETURN_NONE; return ret; } @@ -1980,7 +1980,7 @@ static PyObject *py_register_module(PyObject *module, PyObject *args) PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_timestring(PyObject *module, PyObject *args) diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c index 9cc14b4381..4b092e873a 100644 --- a/source4/lib/messaging/pymessaging.c +++ b/source4/lib/messaging/pymessaging.c @@ -152,7 +152,7 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa return NULL; } - return Py_None; + Py_RETURN_NONE; } static void py_msg_callback_wrapper(struct messaging_context *msg, void *private, @@ -214,7 +214,7 @@ static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObjec Py_DECREF(callback); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject *kwargs) @@ -235,7 +235,7 @@ static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject return NULL; } - return Py_None; + Py_RETURN_NONE; } @@ -252,7 +252,7 @@ static PyObject *py_messaging_remove_name(PyObject *self, PyObject *args, PyObje irpc_remove_name(iface->msg_ctx, name); - return Py_None; + Py_RETURN_NONE; } static PyMethodDef py_messaging_methods[] = { diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c index 357305c4de..444b80a6fe 100644 --- a/source4/lib/registry/pyregistry.c +++ b/source4/lib/registry/pyregistry.c @@ -60,7 +60,7 @@ static PyObject *py_key_del_abs(PyObject *self, PyObject *args) result = reg_key_del_abs(ctx, path); PyErr_WERROR_IS_ERR_RAISE(result); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_get_predefined_key(PyObject *self, PyObject *args) @@ -90,7 +90,7 @@ static PyObject *py_diff_apply(PyObject *self, PyObject *args) result = reg_diff_apply(ctx, py_iconv_convenience(NULL), filename); PyErr_WERROR_IS_ERR_RAISE(result); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_mount_hive(PyObject *self, PyObject *args) @@ -123,7 +123,7 @@ static PyObject *py_mount_hive(PyObject *self, PyObject *args) result = reg_mount_hive(ctx, py_talloc_get_ptr(py_hivekey), hkey, elements); PyErr_WERROR_IS_ERR_RAISE(result); - return Py_None; + Py_RETURN_NONE; } static PyObject *registry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) @@ -172,7 +172,7 @@ static PyObject *py_hive_key_del(PyObject *self, PyObject *args) PyErr_WERROR_IS_ERR_RAISE(result); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_hive_key_flush(PyObject *self) @@ -183,7 +183,7 @@ static PyObject *py_hive_key_flush(PyObject *self) result = hive_key_flush(key); PyErr_WERROR_IS_ERR_RAISE(result); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args) @@ -199,7 +199,7 @@ static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args) PyErr_WERROR_IS_ERR_RAISE(result); - return Py_None; + Py_RETURN_NONE; } static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args) @@ -220,7 +220,7 @@ static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args) PyErr_WERROR_IS_ERR_RAISE(result); - return Py_None; + Py_RETURN_NONE; } static PyMethodDef hive_key_methods[] = { @@ -238,7 +238,7 @@ static PyMethodDef hive_key_methods[] = { static PyObject *hive_open(PyTypeObject *type, PyObject *args, PyObject *kwargs) { /* reg_open_hive */ - return Py_None; + Py_RETURN_NONE; } PyTypeObject PyHiveKey = { @@ -383,7 +383,7 @@ static PyObject *py_get_predef_name(PyObject *self, PyObject *args) str = reg_get_predef_name(hkey); if (str == NULL) - return Py_None; + Py_RETURN_NONE; return PyString_FromString(str); } |