From b4940a25462292e0f10dcf7e106702b66bff1e8c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 11 Dec 2015 18:19:35 +0100 Subject: [PATCH] fixed node_name_long() --- include/node.h | 2 +- lib/node.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/node.h b/include/node.h index eca540e7b..5cd6fb8e9 100644 --- a/include/node.h +++ b/include/node.h @@ -162,7 +162,7 @@ struct node const char *name; /**< A short identifier of the node, only used for configuration and logging */ char *_name; /**< Singleton: A string used to print to screen. */ - char *_name_long; /**< Singleton: A string used to print to screen. */ + const char *_name_long; /**< Singleton: A string used to print to screen. */ int combine; /**< Number of messages to send / recv at once (scatter / gather) */ int affinity; /**< CPU Affinity of this node */ diff --git a/lib/node.c b/lib/node.c index c39827f12..770ec4fd5 100644 --- a/lib/node.c +++ b/lib/node.c @@ -107,8 +107,15 @@ const char * node_name(struct node *n) const char * node_name_long(struct node *n) { - if (!n->_name_long) - n->_name_long = n->_vt->print ? n->_vt->print(n) : node_name(n); + if (!n->_name_long) { + if (n->_vt->print) { + char *name_long = n->_vt->print(n); + strcatf(&n->_name_long, "%s: %s", node_name(n), name_long); + free(name_long); + } + else + n->_name_long = node_name(n); + } return n->_name_long; }