BIND 10 master, updated. eb4917aea94d78ea64fa90f0c70501bbb6d48b37 [master] use c-style cast for functionptr cast

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Oct 4 08:47:57 UTC 2011


The branch, master has been updated
       via  eb4917aea94d78ea64fa90f0c70501bbb6d48b37 (commit)
      from  ebeb5ead60c5c0d7b16478498b78a8f1ef3b71c3 (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 eb4917aea94d78ea64fa90f0c70501bbb6d48b37
Author: Jelte Jansen <jelte at isc.org>
Date:   Tue Oct 4 08:47:26 2011 +0000

    [master] use c-style cast for functionptr cast

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/factory.cc |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/factory.cc b/src/lib/datasrc/factory.cc
index 8ccf27f..eddd4f4 100644
--- a/src/lib/datasrc/factory.cc
+++ b/src/lib/datasrc/factory.cc
@@ -61,10 +61,14 @@ DataSourceClientContainer::DataSourceClientContainer(const std::string& type,
                                                      ConstElementPtr config)
 : ds_lib_(type + "_ds.so")
 {
-    ds_creator* ds_create =
-        reinterpret_cast<ds_creator*>(ds_lib_.getSym("createInstance"));
-    destructor_ =
-        reinterpret_cast<ds_destructor*>(ds_lib_.getSym("destroyInstance"));
+    // We are casting from a data to a function pointer here
+    // Some compilers (rightfully) complain about that, but
+    // c-style casts are accepted the most here. If we run
+    // into any that also don't like this, we might need to
+    // use some form of union cast or memory copy to get
+    // from the void* to the function pointer.
+    ds_creator* ds_create = (ds_creator*)ds_lib_.getSym("createInstance");
+    destructor_ = (ds_destructor*)ds_lib_.getSym("destroyInstance");
 
     instance_ = ds_create(config);
 }




More information about the bind10-changes mailing list