From: Jelte Jansen Date: Tue, 4 Oct 2011 08:47:26 +0000 (+0000) Subject: [master] use c-style cast for functionptr cast X-Git-Tag: perftcpdns_before_epoll~37^2~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eb4917aea94d78ea64fa90f0c70501bbb6d48b37;p=thirdparty%2Fkea.git [master] use c-style cast for functionptr cast --- diff --git a/src/lib/datasrc/factory.cc b/src/lib/datasrc/factory.cc index 8ccf27fd39..eddd4f41c1 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_lib_.getSym("createInstance")); - destructor_ = - reinterpret_cast(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); }