From fc9db1be8c886672e63a1589a5a2b8e9a9561818 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Mon, 30 Mar 2020 17:34:52 +0200 Subject: [PATCH] last call to MSG_hosts_as_dynar -> deprecate ! --- include/simgrid/msg.h | 2 +- src/bindings/java/jmsg.cpp | 10 +++++----- src/msg/msg_legacy.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index e38fd6e1ff..8204478820 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -95,7 +95,7 @@ XBT_PUBLIC size_t MSG_get_host_number(); * The host order in the returned array is generally different from the host creation/declaration order in the XML * platform (we use a hash table internally). */ -XBT_PUBLIC xbt_dynar_t MSG_hosts_as_dynar(); +XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_list()") XBT_PUBLIC xbt_dynar_t MSG_hosts_as_dynar(); /** @brief Returns the name of this host */ XBT_PUBLIC const char* MSG_host_get_name(const_sg_host_t host); diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 3b06e2e57b..80618e0c8c 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -142,14 +142,14 @@ JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv* env, jclass) XBT_INFO("MSG_main finished; Terminating the simulation..."); /* Cleanup java hosts */ - xbt_dynar_t hosts = MSG_hosts_as_dynar(); - for (unsigned long index = 0; index < xbt_dynar_length(hosts) - 1; index++) { - auto const* msg_host = xbt_dynar_get_as(hosts, index, msg_host_t); - jobject jhost = (jobject) msg_host->extension(JAVA_HOST_LEVEL); + sg_host_t* hosts = sg_host_list(); + size_t host_count = sg_host_count(); + for (size_t index = 0; index < host_count - 1; index++) { + jobject jhost = (jobject)hosts[index]->extension(JAVA_HOST_LEVEL); if (jhost) jhost_unref(env, jhost); } - xbt_dynar_free(&hosts); + xbt_free(hosts); /* Cleanup java storages */ for (auto const& elm : java_storage_map) diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp index 6ddae74269..26693aa738 100644 --- a/src/msg/msg_legacy.cpp +++ b/src/msg/msg_legacy.cpp @@ -299,7 +299,7 @@ sg_size_t MSG_storage_write(sg_storage_t storage, sg_size_t size) } /* ************************** hosts *************************** */ -xbt_dynar_t MSG_hosts_as_dynar() +xbt_dynar_t MSG_hosts_as_dynar() // XBT_ATTRIB_DEPRECATED_v330 { size_t host_count = sg_host_count(); sg_host_t* list = sg_host_list(); -- 2.20.1