BIND 10 trac1484, updated. 3e851b72d4869bd4e7ede881aac0470da39aef3a [1484] some trivial (and unrelated for some) cleanups: - indentation - constify - eleiminating unnecessary reinterpret_cast
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Dec 20 22:37:40 UTC 2011
The branch, trac1484 has been updated
via 3e851b72d4869bd4e7ede881aac0470da39aef3a (commit)
from d2f1ad06d2beb7ab5f51357bf191a9aaf56ddb2f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3e851b72d4869bd4e7ede881aac0470da39aef3a
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Tue Dec 20 14:37:02 2011 -0800
[1484] some trivial (and unrelated for some) cleanups:
- indentation
- constify
- eleiminating unnecessary reinterpret_cast
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/datasrc/finder_python.cc | 14 +++++++-------
src/lib/python/isc/datasrc/updater_python.cc | 24 ++++++++++++------------
2 files changed, 19 insertions(+), 19 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/datasrc/finder_python.cc b/src/lib/python/isc/datasrc/finder_python.cc
index e65e6de..19868f5 100644
--- a/src/lib/python/isc/datasrc/finder_python.cc
+++ b/src/lib/python/isc/datasrc/finder_python.cc
@@ -102,9 +102,8 @@ PyObject* ZoneFinder_helper_all(ZoneFinder* finder, PyObject* args) {
return (NULL);
}
PyObject* name;
- unsigned int options_int = ZoneFinder::FIND_DEFAULT;
- if (PyArg_ParseTuple(args, "O!|I", &name_type, &name,
- &options_int)) {
+ const unsigned int options_int = ZoneFinder::FIND_DEFAULT;
+ if (PyArg_ParseTuple(args, "O!|I", &name_type, &name, &options_int)) {
try {
ZoneFinder::FindOptions options =
static_cast<ZoneFinder::FindOptions>(options_int);
@@ -171,7 +170,7 @@ typedef CPPPyObjectContainer<s_ZoneFinder, ZoneFinder> ZoneFinderContainer;
// General creation and destruction
int
-ZoneFinder_init(s_ZoneFinder* self, PyObject* args) {
+ZoneFinder_init(PyObject*, PyObject*, PyObject*) {
// can't be called directly
PyErr_SetString(PyExc_TypeError,
"ZoneFinder cannot be constructed directly");
@@ -180,7 +179,8 @@ ZoneFinder_init(s_ZoneFinder* self, PyObject* args) {
}
void
-ZoneFinder_destroy(s_ZoneFinder* const self) {
+ZoneFinder_destroy(PyObject* po_self) {
+ s_ZoneFinder* self = static_cast<s_ZoneFinder*>(po_self);
// cppobj is a shared ptr, but to make sure things are not destroyed in
// the wrong order, we reset it here.
self->cppobj.reset();
@@ -282,7 +282,7 @@ PyTypeObject zonefinder_type = {
"datasrc.ZoneFinder",
sizeof(s_ZoneFinder), // tp_basicsize
0, // tp_itemsize
- reinterpret_cast<destructor>(ZoneFinder_destroy),// tp_dealloc
+ ZoneFinder_destroy, // tp_dealloc
NULL, // tp_print
NULL, // tp_getattr
NULL, // tp_setattr
@@ -313,7 +313,7 @@ PyTypeObject zonefinder_type = {
NULL, // tp_descr_get
NULL, // tp_descr_set
0, // tp_dictoffset
- reinterpret_cast<initproc>(ZoneFinder_init),// tp_init
+ ZoneFinder_init, // tp_init
NULL, // tp_alloc
PyType_GenericNew, // tp_new
NULL, // tp_free
diff --git a/src/lib/python/isc/datasrc/updater_python.cc b/src/lib/python/isc/datasrc/updater_python.cc
index 00b8940..c528a0c 100644
--- a/src/lib/python/isc/datasrc/updater_python.cc
+++ b/src/lib/python/isc/datasrc/updater_python.cc
@@ -75,7 +75,7 @@ typedef CPPPyObjectContainer<s_ZoneUpdater, ZoneUpdater> ZoneUpdaterContainer;
// General creation and destruction
int
-ZoneUpdater_init(s_ZoneUpdater* self, PyObject* args) {
+ZoneUpdater_init(PyObject*, PyObject*, PyObject*) {
// can't be called directly
PyErr_SetString(PyExc_TypeError,
"ZoneUpdater cannot be constructed directly");
@@ -84,7 +84,9 @@ ZoneUpdater_init(s_ZoneUpdater* self, PyObject* args) {
}
void
-ZoneUpdater_destroy(s_ZoneUpdater* const self) {
+ZoneUpdater_destroy(PyObject* po_self) {
+ s_ZoneUpdater* const self = static_cast<s_ZoneUpdater*>(po_self);
+
// cppobj is a shared ptr, but to make sure things are not destroyed in
// the wrong order, we reset it here.
self->cppobj.reset();
@@ -200,22 +202,20 @@ ZoneUpdater_find_all(PyObject* po_self, PyObject* args) {
// 3. Argument type
// 4. Documentation
PyMethodDef ZoneUpdater_methods[] = {
- { "add_rrset", reinterpret_cast<PyCFunction>(ZoneUpdater_addRRset),
+ { "add_rrset", ZoneUpdater_addRRset,
METH_VARARGS, ZoneUpdater_addRRset_doc },
- { "delete_rrset", reinterpret_cast<PyCFunction>(ZoneUpdater_deleteRRset),
+ { "delete_rrset", ZoneUpdater_deleteRRset,
METH_VARARGS, ZoneUpdater_deleteRRset_doc },
- { "commit", reinterpret_cast<PyCFunction>(ZoneUpdater_commit), METH_NOARGS,
- ZoneUpdater_commit_doc },
+ { "commit", ZoneUpdater_commit, METH_NOARGS, ZoneUpdater_commit_doc },
// Instead of a getFinder, we implement the finder functionality directly
// This is because ZoneFinder is non-copyable, and we should not create
// a ZoneFinder object from a reference only (which is what is returned
// by getFinder(). Apart from that
- { "get_origin", reinterpret_cast<PyCFunction>(ZoneUpdater_getOrigin),
+ { "get_origin", ZoneUpdater_getOrigin,
METH_NOARGS, ZoneFinder_getOrigin_doc },
- { "get_class", reinterpret_cast<PyCFunction>(ZoneUpdater_getClass),
+ { "get_class", ZoneUpdater_getClass,
METH_NOARGS, ZoneFinder_getClass_doc },
- { "find", reinterpret_cast<PyCFunction>(ZoneUpdater_find), METH_VARARGS,
- ZoneFinder_find_doc },
+ { "find", ZoneUpdater_find, METH_VARARGS, ZoneFinder_find_doc },
{ "find_all", ZoneUpdater_find_all, METH_VARARGS,
ZoneFinder_find_all_doc },
{ NULL, NULL, 0, NULL }
@@ -231,7 +231,7 @@ PyTypeObject zoneupdater_type = {
"datasrc.ZoneUpdater",
sizeof(s_ZoneUpdater), // tp_basicsize
0, // tp_itemsize
- reinterpret_cast<destructor>(ZoneUpdater_destroy),// tp_dealloc
+ ZoneUpdater_destroy, // tp_dealloc
NULL, // tp_print
NULL, // tp_getattr
NULL, // tp_setattr
@@ -262,7 +262,7 @@ PyTypeObject zoneupdater_type = {
NULL, // tp_descr_get
NULL, // tp_descr_set
0, // tp_dictoffset
- reinterpret_cast<initproc>(ZoneUpdater_init),// tp_init
+ ZoneUpdater_init, // tp_init
NULL, // tp_alloc
PyType_GenericNew, // tp_new
NULL, // tp_free
More information about the bind10-changes
mailing list