From 15196af5d6b5712575ba49aa908600b8d43da050 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 2 Oct 2017 09:52:51 -0600 Subject: [PATCH] Remove one case of UB union work --- include/chaiscript/language/chaiscript_posix.hpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/include/chaiscript/language/chaiscript_posix.hpp b/include/chaiscript/language/chaiscript_posix.hpp index 62f1c117..87b66881 100644 --- a/include/chaiscript/language/chaiscript_posix.hpp +++ b/include/chaiscript/language/chaiscript_posix.hpp @@ -41,7 +41,7 @@ namespace chaiscript struct DLSym { DLSym(DLModule &t_mod, const std::string &t_symbol) - : m_symbol(cast_symbol(dlsym(t_mod.m_data, t_symbol.c_str()))) + : m_symbol(reinterpret_cast(dlsym(t_mod.m_data, t_symbol.c_str()))) { if (!m_symbol) { @@ -49,19 +49,6 @@ namespace chaiscript } } - static T cast_symbol(void *p) - { - union cast_union - { - T func_ptr; - void *in_ptr; - }; - - cast_union c; - c.in_ptr = p; - return c.func_ptr; - } - T m_symbol; };