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

path: remove path_uses_node()

This commit is contained in:
Steffen Vogel 2020-09-10 13:20:50 +02:00
parent 458cfe151c
commit f5e74e3dbf
3 changed files with 1 additions and 29 deletions

View file

@ -144,9 +144,6 @@ struct vlist * path_output_signals(struct vpath *n);
/** Reverse a path */
int path_reverse(struct vpath *p, struct vpath *r);
/** Check if node is used as source or destination of a path. */
int path_uses_node(struct vpath *p, struct vnode *n);
/** Parse a single path and add it to the global configuration.
*
* @param cfg A JSON object containing the configuration of the path.

View file

@ -787,25 +787,6 @@ struct vlist * path_output_signals(struct vpath *p)
return &p->signals;
}
int path_uses_node(struct vpath *p, struct vnode *n)
{
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
struct vpath_destination *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
if (pd->node == n)
return 0;
}
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
if (ps->node == n)
return 0;
}
return -1;
}
bool path_is_simple(const struct vpath *p)
{
int ret;

View file

@ -314,17 +314,11 @@ void SuperNode::startPaths()
void SuperNode::prepareNodes()
{
int ret, refs;
int ret;
for (size_t i = 0; i < vlist_length(&nodes); i++) {
auto *n = (struct vnode *) vlist_at(&nodes, i);
refs = vlist_count(&paths, (cmp_cb_t) path_uses_node, n);
if (refs <= 0) {
logger->warn("No path is using the node {}. Skipping...", node_name(n));
n->enabled = false;
}
if (!node_is_enabled(n))
continue;