From: Arnaud Giersch Date: Tue, 11 Feb 2020 08:05:10 +0000 (+0100) Subject: [sonar] Add const. X-Git-Tag: v3.26~972 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6515dfa782c4b3efa13c87a30709fbca1c5b111f [sonar] Add const. --- diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 71d594acdd..754a8bcf88 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -68,7 +68,7 @@ XBT_PUBLIC xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host); * @return a dynar containing all storages (name) attached to the host */ XBT_PUBLIC xbt_dynar_t sg_host_get_attached_storage_list(const_sg_host_t host); -XBT_PUBLIC void sg_host_disks(sg_host_t host, unsigned int* disk_count, sg_disk_t** disks); +XBT_PUBLIC void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks); // =========== user-level functions =============== /** @brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. */ diff --git a/src/kernel/activity/IoImpl.cpp b/src/kernel/activity/IoImpl.cpp index 966cae13da..c9ec8eeecb 100644 --- a/src/kernel/activity/IoImpl.cpp +++ b/src/kernel/activity/IoImpl.cpp @@ -21,7 +21,7 @@ namespace activity { IoImpl& IoImpl::set_timeout(double timeout) { - s4u::Host* host = get_disk() ? get_disk()->get_host() : s4u::Host::by_name(get_storage()->get_host()); + const s4u::Host* host = get_disk() ? get_disk()->get_host() : s4u::Host::by_name(get_storage()->get_host()); timeout_detector_ = host->pimpl_cpu->sleep(timeout); timeout_detector_->set_activity(this); return *this; diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index a4aad5cccf..f366323f75 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -389,7 +389,7 @@ void sg_host_user_destroy(sg_host_t host) // deprecated } // ========= storage related functions ============ -void sg_host_disks(sg_host_t host, unsigned int* disk_count, sg_disk_t** disks) +void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks) { std::vector list = host->get_disks(); *disk_count = list.size();