From 79d3a21b651a5cf5e03059d22ca4c7d6d9c4e5a1 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 22 Oct 2019 21:48:43 +0100 Subject: [PATCH] Minor code tidy-up. --- vpi_modules.cc | 9 +++------ vvp/vpi_modules.cc | 18 +++++++----------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/vpi_modules.cc b/vpi_modules.cc index 0952f8913..7dca89ab0 100644 --- a/vpi_modules.cc +++ b/vpi_modules.cc @@ -240,19 +240,16 @@ bool load_vpi_module(const char*path) return false; } - vpip_set_callback_t set_callback = (vpip_set_callback_t)ivl_dlsym(dll, "vpip_set_callback"); - if (set_callback == 0) { + void*function = ivl_dlsym(dll, "vpip_set_callback"); + if (function == 0) { cerr << "warning: '" << path << "' has no vpip_set_callback()" << endl; ivl_dlclose(dll); return true; } + vpip_set_callback_t set_callback = (vpip_set_callback_t)function; set_callback(&vpi_routines); -#ifdef __MINGW32__ - void*table = ivl_dlsym(dll, "vlog_startup_routines"); -#else void*table = ivl_dlsym(dll, LU "vlog_startup_routines" TU); -#endif if (table == 0) { cerr << "warning: '" << path << "' has no vlog_startup_routines" << endl; ivl_dlclose(dll); diff --git a/vvp/vpi_modules.cc b/vvp/vpi_modules.cc index e7e189878..1e8ffe945 100644 --- a/vvp/vpi_modules.cc +++ b/vvp/vpi_modules.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2018 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2019 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -216,20 +216,16 @@ void vpip_load_module(const char*name) return; } - vpip_set_callback_t set_callback = (vpip_set_callback_t)ivl_dlsym(dll, "vpip_set_callback"); - if (set_callback == 0) { - fprintf(stderr, "%s: no vpip_set_callback\n", name); - ivl_dlclose(dll); - return; + void*function = ivl_dlsym(dll, "vpip_set_callback"); + if (function == 0) { + fprintf(stderr, "%s: no vpip_set_callback()\n", name); + ivl_dlclose(dll); + return; } + vpip_set_callback_t set_callback = (vpip_set_callback_t)function; set_callback(&vpi_routines); -#ifdef __MINGW32__ - /* For this check MinGW does not want the leading underscore! */ - void*table = ivl_dlsym(dll, "vlog_startup_routines"); -#else void*table = ivl_dlsym(dll, LU "vlog_startup_routines" TU); -#endif if (table == 0) { fprintf(stderr, "%s: no vlog_startup_routines\n", name); ivl_dlclose(dll);