* Allocate and initialize a new node. */
| 154 | * Allocate and initialize a new node. |
| 155 | */ |
| 156 | static struct rte_acl_node * |
| 157 | acl_alloc_node(struct acl_build_context *context, int level) |
| 158 | { |
| 159 | struct rte_acl_node *node; |
| 160 | |
| 161 | if (context->node_free_list != NULL) { |
| 162 | node = context->node_free_list; |
| 163 | context->node_free_list = node->next; |
| 164 | memset(node, 0, sizeof(struct rte_acl_node)); |
| 165 | } else { |
| 166 | node = acl_build_alloc(context, sizeof(struct rte_acl_node), 1); |
| 167 | } |
| 168 | |
| 169 | if (node != NULL) { |
| 170 | node->num_ptrs = 0; |
| 171 | node->level = level; |
| 172 | node->node_type = RTE_ACL_NODE_UNDEFINED; |
| 173 | node->node_index = RTE_ACL_NODE_UNDEFINED; |
| 174 | context->num_nodes++; |
| 175 | node->id = context->node_id++; |
| 176 | } |
| 177 | return node; |
| 178 | } |
| 179 | |
| 180 | /* |
| 181 | * Dereference all nodes to which this node points |
no test coverage detected