From 1677a24a253d883f3db0744651ea5cb489cbf73a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 23 Dec 2015 00:46:09 +0100 Subject: [PATCH] inline onliners with lambdas --- src/simgrid/host.cpp | 15 ++++++--------- src/surf/host_interface.cpp | 8 +++----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index d707b3e8c3..7f1a381ad9 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -66,23 +66,20 @@ int USER_HOST_LEVEL; #include "src/surf/cpu_interface.hpp" #include "src/surf/surf_routing.hpp" -static XBT_INLINE void surf_cpu_free(void *r) { - delete static_cast(r); -} -static XBT_INLINE void routing_asr_host_free(void *p) { - delete static_cast(p); -} - void sg_host_init() { MSG_HOST_LEVEL = simgrid::Host::extension_create([](void *p) { __MSG_host_priv_free((msg_host_priv_t) p); }); + + ROUTING_HOST_LEVEL = simgrid::Host::extension_create([](void *p) { + delete static_cast(p); + }); + SD_HOST_LEVEL = simgrid::Host::extension_create(__SD_workstation_destroy); SIMIX_HOST_LEVEL = simgrid::Host::extension_create(SIMIX_host_destroy); - simgrid::surf::Cpu::classInit(); - ROUTING_HOST_LEVEL = simgrid::Host::extension_create(routing_asr_host_free); USER_HOST_LEVEL = simgrid::Host::extension_create(NULL); + simgrid::surf::Cpu::classInit(); } // ========== User data Layer ========== diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index a9f48dded7..5563e1b498 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -79,14 +79,12 @@ simgrid::surf::signal Host::onCreation; simgrid::surf::signal Host::onDestruction; simgrid::surf::signal Host::onStateChange; -static void host_destroy(void *h){ - static_cast(h)->destroy(); -} - void Host::classInit() { if (!EXTENSION_ID.valid()) { - EXTENSION_ID = simgrid::Host::extension_create(host_destroy); + EXTENSION_ID = simgrid::Host::extension_create([](void *h) { + static_cast(h)->destroy(); + }); SURF_HOST_LEVEL = EXTENSION_ID.id(); // FIXME: KILLME } } -- 2.20.1