From b89a1ce004bff692ee331f4f76047b414d07b696 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Fri, 1 Jul 2022 10:37:11 +0200 Subject: [PATCH] Sonar issues. --- examples/c/cloud-migration/cloud-migration.c | 2 +- src/kernel/routing/NetZoneImpl.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/c/cloud-migration/cloud-migration.c b/examples/c/cloud-migration/cloud-migration.c index 6d8f7b516c..b1c5dc2618 100644 --- a/examples/c/cloud-migration/cloud-migration.c +++ b/examples/c/cloud-migration/cloud-migration.c @@ -34,7 +34,7 @@ static void migration_worker_main(int argc, char* argv[]) const char* dst_pm_name = argv[2]; sg_host_t src_pm = sg_host_self(); - sg_vm_t vm = (sg_vm_t)sg_vm_by_name(src_pm, vm_name); + sg_vm_t vm = sg_vm_by_name(src_pm, vm_name); sg_host_t dst_pm = sg_host_by_name(dst_pm_name); vm_migrate(vm, dst_pm); diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index fe2c721691..18d00d930d 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -343,13 +343,11 @@ resource::SplitDuplexLinkImpl* NetZoneImpl::get_split_duplex_link_by_name_or_nul resource::HostImpl* NetZoneImpl::get_host_by_name_or_null(const std::string& name) const { - auto host_it = hosts_.find(name); - if (host_it != hosts_.end()) + if (auto host_it = hosts_.find(name); host_it != hosts_.end()) return host_it->second; for (const auto* child : children_) { - auto* host = child->get_host_by_name_or_null(name); - if (host) + if (auto* host = child->get_host_by_name_or_null(name)) return host; } -- 2.20.1