From 8b01c3da3357b6e4ca6e2855e8202891343d42f0 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 5 Jul 2013 13:29:29 +0000 Subject: [PATCH] Slightly reorder the code. This commit was SVN r28725. --- .../topo/base/topo_base_dist_graph_create.c | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/ompi/mca/topo/base/topo_base_dist_graph_create.c b/ompi/mca/topo/base/topo_base_dist_graph_create.c index c3f75d3b01..76bef7c672 100644 --- a/ompi/mca/topo/base/topo_base_dist_graph_create.c +++ b/ompi/mca/topo/base/topo_base_dist_graph_create.c @@ -124,6 +124,8 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module, err = OMPI_ERR_OUT_OF_RESOURCE; goto bail_out; } + topo->in = topo->inw = NULL; + topo->out = topo->outw = NULL; topo->indegree = idx[0].in; topo->outdegree = idx[0].out; topo->weighted = (weights != MPI_UNWEIGHTED); @@ -133,8 +135,13 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module, err = OMPI_ERR_OUT_OF_RESOURCE; goto bail_out; } - } else { - topo->in = NULL; + if (MPI_UNWEIGHTED != weights) { + topo->inw = (int*)malloc(sizeof(int) * topo->indegree); + if (NULL == topo->inw) { + err = OMPI_ERR_OUT_OF_RESOURCE; + goto bail_out; + } + } } if (topo->outdegree > 0) { topo->out = (int*)malloc(sizeof(int) * topo->outdegree); @@ -142,21 +149,7 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module, err = OMPI_ERR_OUT_OF_RESOURCE; goto bail_out; } - } else { - topo->out = NULL; - } - - topo->inw = NULL; - topo->outw = NULL; - if (MPI_UNWEIGHTED != weights) { - if (topo->indegree > 0) { - topo->inw = (int*)malloc(sizeof(int) * topo->indegree); - if (NULL == topo->inw) { - err = OMPI_ERR_OUT_OF_RESOURCE; - goto bail_out; - } - } - if (topo->outdegree > 0) { + if (MPI_UNWEIGHTED != weights) { topo->outw = (int*)malloc(sizeof(int) * topo->outdegree); if (NULL == topo->outw) { err = OMPI_ERR_OUT_OF_RESOURCE;