Skip to content

Commit 5de58da

Browse files
committed
lstopo: make sure the output of distances is portable
AIX 7.2 shows "" instead of "(null)" for empty strings, fixup that so that make check works there too. Signed-off-by: Brice Goglin <[email protected]>
1 parent 69f04b2 commit 5de58da

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

utils/lstopo/lstopo-text.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright © 2009 CNRS
3-
* Copyright © 2009-2019 Inria. All rights reserved.
3+
* Copyright © 2009-2020 Inria. All rights reserved.
44
* Copyright © 2009-2012 Université Bordeaux
55
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
66
* See COPYING in top-level directory.
@@ -225,14 +225,17 @@ static void output_distances(struct lstopo_output *loutput)
225225
if (!err) {
226226
for(j=0; j<nr; j++) {
227227
const char *kindmeans = (dist[j]->kind & HWLOC_DISTANCES_KIND_MEANS_LATENCY) ? "latency" : (dist[j]->kind & HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH) ? "bandwidth" : "distance";
228+
const char *name = hwloc_distances_get_name(topology, dist[j]);
229+
if (!name)
230+
name = "(null)";
228231
if (dist[j]->kind & HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES) {
229232
fprintf(output, "Relative %s matrix (name %s kind %lu) between %u heterogeneous objects by %s indexes:\n",
230-
kindmeans, hwloc_distances_get_name(topology, dist[j]), dist[j]->kind,
233+
kindmeans, name, dist[j]->kind,
231234
dist[j]->nbobjs,
232235
index_type != LSTOPO_INDEX_TYPE_PHYSICAL ? "logical" : "physical");
233236
} else {
234237
fprintf(output, "Relative %s matrix (name %s kind %lu) between %u %ss (depth %d) by %s indexes:\n",
235-
kindmeans, hwloc_distances_get_name(topology, dist[j]), dist[j]->kind,
238+
kindmeans, name, dist[j]->kind,
236239
dist[j]->nbobjs,
237240
hwloc_obj_type_string(dist[j]->objs[0]->type),
238241
dist[j]->objs[0]->depth,

0 commit comments

Comments
 (0)