Skip to content

Commit c92e9a5

Browse files
committed
use the new OPAL_HASH_TABLE_FOREACH convenience macro
1 parent 23a8f76 commit c92e9a5

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

opal/mca/btl/ugni/btl_ugni_module.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
44
* reserved.
55
* Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
6-
* Copyright (c) 2014 Research Organization for Information Science
6+
* Copyright (c) 2014-2016 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
88
* $COPYRIGHT$
99
*
@@ -144,13 +144,10 @@ mca_btl_ugni_module_finalize (struct mca_btl_base_module_t *btl)
144144

145145
/* close all open connections and release endpoints */
146146
if (ugni_module->initialized) {
147-
rc = opal_hash_table_get_first_key_uint64 (&ugni_module->id_to_endpoint, &key, (void **) &ep, &node);
148-
while (OPAL_SUCCESS == rc) {
147+
OPAL_HASH_TABLE_FOREACH(key, uint64, ep, &ugni_module->id_to_endpoint) {
149148
if (NULL != ep) {
150149
mca_btl_ugni_release_ep (ep);
151150
}
152-
153-
rc = opal_hash_table_get_next_key_uint64 (&ugni_module->id_to_endpoint, &key, (void **) &ep, node, &node);
154151
}
155152

156153
if (mca_btl_ugni_component.progress_thread_enabled) {

orte/mca/oob/base/oob_base_frame.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
1515
* reserved.
16-
* Copyright (c) 2015 Research Organization for Information Science
16+
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -79,8 +79,6 @@ static int orte_oob_base_close(void)
7979
mca_base_component_list_item_t *cli;
8080
opal_object_t *value;
8181
uint64_t key;
82-
void *node;
83-
int rc;
8482

8583
/* shutdown all active transports */
8684
while (NULL != (cli = (mca_base_component_list_item_t *) opal_list_remove_first (&orte_oob_base.actives))) {
@@ -95,14 +93,10 @@ static int orte_oob_base_close(void)
9593
OBJ_DESTRUCT(&orte_oob_base.actives);
9694

9795
/* release all peers from the hash table */
98-
rc = opal_hash_table_get_first_key_uint64 (&orte_oob_base.peers, &key,
99-
(void **) &value, &node);
100-
while (OPAL_SUCCESS == rc) {
96+
OPAL_HASH_TABLE_FOREACH(key, uint64, value, &orte_oob_base.peers) {
10197
if (NULL != value) {
10298
OBJ_RELEASE(value);
10399
}
104-
rc = opal_hash_table_get_next_key_uint64 (&orte_oob_base.peers, &key,
105-
(void **) &value, node, &node);
106100
}
107101

108102
OBJ_DESTRUCT(&orte_oob_base.peers);

orte/mca/oob/tcp/oob_tcp.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
1616
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2016 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -147,29 +149,17 @@ static void tcp_init(void)
147149
static void tcp_fini(void)
148150
{
149151
uint64_t ui64;
150-
char *nptr;
151152
mca_oob_tcp_peer_t *peer;
152153

153154
/* cleanup all peers */
154-
if (OPAL_SUCCESS == opal_hash_table_get_first_key_uint64(&mca_oob_tcp_module.peers, &ui64,
155-
(void**)&peer, (void**)&nptr)) {
155+
OPAL_HASH_TABLE_FOREACH(ui64, uint64, peer, &mca_oob_tcp_module.peers) {
156156
opal_output_verbose(2, orte_oob_base_framework.framework_output,
157157
"%s RELEASING PEER OBJ %s",
158158
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
159159
(NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
160160
if (NULL != peer) {
161161
OBJ_RELEASE(peer);
162162
}
163-
while (OPAL_SUCCESS == opal_hash_table_get_next_key_uint64(&mca_oob_tcp_module.peers, &ui64,
164-
(void**)&peer, nptr, (void**)&nptr)) {
165-
opal_output_verbose(2, orte_oob_base_framework.framework_output,
166-
"%s RELEASING PEER OBJ %s",
167-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
168-
(NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
169-
if (NULL != peer) {
170-
OBJ_RELEASE(peer);
171-
}
172-
}
173163
}
174164
OBJ_DESTRUCT(&mca_oob_tcp_module.peers);
175165

0 commit comments

Comments
 (0)