1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fixed node_name_long()

This commit is contained in:
Steffen Vogel 2015-12-11 18:19:35 +01:00
parent 00b0457102
commit b4940a2546
2 changed files with 10 additions and 3 deletions

View file

@ -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 */

View file

@ -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;
}