Refactor: centralize T_NEXUS init

parent 96a7987e
...@@ -234,8 +234,19 @@ node_new(struct pesi *pesi, enum n_type type, enum n_state state) ...@@ -234,8 +234,19 @@ node_new(struct pesi *pesi, enum n_type type, enum n_state state)
AN(node); AN(node);
node->type = type; node->type = type;
node->state = state; node->state = state;
if (type == T_NEXUS) switch (type) {
case T_NEXUS:
VSTAILQ_INIT(&node->nexus.children); VSTAILQ_INIT(&node->nexus.children);
node->nexus.gzip.magic = NEXUS_GZIP_MAGIC;
break;
case T_DATA:
case T_CRC:
case T_SUBREQ:
break;
default:
WRONG("node type in node_new");
}
return (node); return (node);
} }
......
...@@ -639,7 +639,6 @@ root_node_new(struct pesi *pesi, struct req *req) ...@@ -639,7 +639,6 @@ root_node_new(struct pesi *pesi, struct req *req)
root_node = node_new(pesi, T_NEXUS, ST_PRIVATE); root_node = node_new(pesi, T_NEXUS, ST_PRIVATE);
CHECK_OBJ_NOTNULL(root_node, NODE_MAGIC); CHECK_OBJ_NOTNULL(root_node, NODE_MAGIC);
root_node->nexus.req = req; root_node->nexus.req = req;
root_node->nexus.gzip.magic = NEXUS_GZIP_MAGIC;
root_node->nexus.npending_private = 1; root_node->nexus.npending_private = 1;
return (root_node); return (root_node);
...@@ -992,7 +991,6 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv, ...@@ -992,7 +991,6 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
AZ(child); AZ(child);
child = node_new(pesi, T_NEXUS, ST_PRIVATE); child = node_new(pesi, T_NEXUS, ST_PRIVATE);
CHECK_OBJ_NOTNULL(child, NODE_MAGIC); CHECK_OBJ_NOTNULL(child, NODE_MAGIC);
child->nexus.gzip.magic = NEXUS_GZIP_MAGIC;
node_insert(tree, node, child); node_insert(tree, node, child);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment