1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018, Olivier MATZ <zer0@droids-corp.org>
6 * Helpers that are commonly used in nodes.
9 #ifndef ECOLI_NODE_HELPERS_
10 #define ECOLI_NODE_HELPERS
15 * Build a node table from a node list in a ec_config.
17 * The function takes a node configuration as parameter, which must be a
18 * node list. From it, a node table is built. A reference is taken for
21 * On error, no reference is taken.
24 * The configuration (type must be a list of nodes). If it is
25 * NULL, an error is returned.
27 * The length of the allocated table on success, or 0 on error.
29 * The allocated node table, that must be freed by the caller:
30 * each entry must be freed with ec_node_free() and the table
31 * with ec_free(). On error, NULL is returned and errno is set.
34 ec_node_config_node_list_to_table(const struct ec_config *config,
38 * Build a list of config nodes from variable arguments.
40 * The va_list argument is a list of pointer to ec_node structures,
41 * terminated with EC_NODE_ENDLIST.
43 * This helper is used by nodes that contain a list of nodes,
44 * like "seq", "or", ...
47 * List of pointer to ec_node structures, terminated with
50 * A pointer to an ec_config structure. In this case, the
51 * nodes will be freed when the config structure will be freed.
52 * On error, NULL is returned (and errno is set), and the
56 ec_node_config_node_list_from_vargs(va_list ap);