bool needs_resolving; //!< Needs pass2 resolution.
bool needs_async; //!< Node and all child nodes are guaranteed to not
///< require asynchronous expansion.
+ bool pure; //!< has no external side effects
} xlat_flags_t;
extern fr_table_num_sorted_t const xlat_action_table[];
node->type = type;
if (in) node->fmt = talloc_bstrndup(node, in, inlen);
+ node->flags.pure = (type == XLAT_LITERAL);
+
return node;
}
static inline CC_HINT(always_inline) void xlat_exp_set_type(xlat_exp_t *node, xlat_type_t type)
{
node->type = type;
+
+ if (type == XLAT_LITERAL) {
+ node->flags.needs_async = false; /* literals are always non-async */
+ node->flags.pure = true; /* literals are always pure */
+ }
}
#if 0
{
parent->needs_async |= child->needs_async;
parent->needs_resolving |= child->needs_resolving;
+ parent->pure &= child->pure; /* purity can only be removed, never added */
}
/** Free a linked list of xlat nodes
escapes ? escapes->name : "(none)",
fr_box_strvalue_len(str, talloc_array_length(str) - 1));
XLAT_HEXDUMP((uint8_t const *)str, talloc_array_length(str) - 1, " LITERAL ");
- node->flags.needs_async = false; /* literals are always true */
fr_cursor_insert(&cursor, node);
node = NULL;
}
node->child = xlat_exp_alloc_null(node);
xlat_exp_set_type(node->child, XLAT_LITERAL);
- node->flags.needs_async = false; /* Literals are always needs_async */
slen = fr_sbuff_out_aunescape_until(node->child, &str, &our_in, SIZE_MAX,
value_parse_rules_single_quoted.terminals,