/** See if the input is truthy or not.
*
- * @param[in] ctx talloc ctx
- * @param[in,out] dst value-box containing the output box
+ * @param[in] rctx our ctx
* @param[in] in list of value-boxes to check
* @return
* - false on failure
*
* Empty lists are not truthy.
*/
-static bool xlat_logical_or(TALLOC_CTX *ctx, fr_value_box_t **dst, fr_value_box_list_t const *in)
+static bool xlat_logical_or(xlat_logical_rctx_t *rctx, fr_value_box_list_t const *in)
{
fr_value_box_t *found = NULL;
*/
fr_value_box_list_foreach(in, box) {
if (fr_box_is_group(box)) {
- if (!xlat_logical_or(ctx, dst, &box->vb_group)) return false;
+ if (!xlat_logical_or(rctx, &box->vb_group)) return false;
continue;
}
return false;
}
- if (!*dst) {
- MEM(*dst = fr_value_box_alloc_null(ctx));
+ if (!rctx->box) {
+ MEM(rctx->box = fr_value_box_alloc_null(rctx->ctx));
} else {
- fr_value_box_clear(*dst);
+ fr_value_box_clear(rctx->box);
}
- fr_value_box_copy(*dst, *dst, found);
+ fr_value_box_copy(rctx->box, rctx->box, found);
return true;
}
*
* (a, b, c) || (d, e, f) == a || b || c || d || e || f
*/
- match = xlat_logical_or(rctx->ctx, &rctx->box, &rctx->list);
+ match = xlat_logical_or(rctx, &rctx->list);
if (match) goto done;
fr_value_box_list_talloc_free(&rctx->list);
/** See if the input is truthy or not.
*
- * @param[in] ctx talloc ctx
- * @param[in,out] dst value-box containing the output box
+ * @param[in] rctx our ctx
* @param[in] in list of value-boxes to check
* @return
* - false on failure
*
* Empty lists are not truthy.
*/
-static bool xlat_logical_and(TALLOC_CTX *ctx, fr_value_box_t **dst, fr_value_box_list_t const *in)
+static bool xlat_logical_and(xlat_logical_rctx_t *rctx, fr_value_box_list_t const *in)
{
fr_value_box_t *found = NULL;
*/
fr_value_box_list_foreach(in, box) {
if (fr_box_is_group(box)) {
- if (!xlat_logical_or(ctx, dst, &box->vb_group)) return false;
+ if (!xlat_logical_or(rctx, &box->vb_group)) return false;
continue;
}
return false;
}
- if (!*dst) {
- MEM(*dst = fr_value_box_alloc_null(ctx));
+ if (!rctx->box) {
+ MEM(rctx->box = fr_value_box_alloc_null(rctx));
} else {
- fr_value_box_clear(*dst);
+ fr_value_box_clear(rctx->box);
}
- fr_value_box_copy(*dst, *dst, found);
+ fr_value_box_copy(rctx->box, rctx->box, found);
return true;
}
*
* (a, b, c) && (d, e, f) == a && b && c && d && e && f
*/
- match = xlat_logical_and(rctx->ctx, &rctx->box, &rctx->list);
+ match = xlat_logical_and(rctx, &rctx->list);
if (!match) return XLAT_ACTION_FAIL;
fr_value_box_list_talloc_free(&rctx->list);