]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
simplifications
authorAlan T. DeKok <aland@freeradius.org>
Tue, 23 Aug 2022 19:33:20 +0000 (15:33 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 25 Aug 2022 13:20:19 +0000 (09:20 -0400)
src/lib/unlang/xlat_expr.c

index 6e10908b7d838472110f523a6add8cf6ef0e3b8f..de5b96d77085b72a740e012bf62303ba8c302fdb 100644 (file)
@@ -1757,17 +1757,6 @@ static const fr_sbuff_term_elem_t binary_ops[T_TOKEN_LAST] = {
        [ T_OP_REG_NE ]         = L("reg_ne"),
 };
 
-/*
- *     These operations are N-ary.  i.e. we can concatenate all of
- *     their arguments together.
- *
- *     @todo - add T_ADD
- */
-static const bool nary_ops[T_TOKEN_LAST] = {
-       [T_LAND] = true,
-       [T_LOR] = true,
-};
-
 /*
  *     Which are logical operations
  */
@@ -2636,14 +2625,12 @@ redo:
        fr_assert(func != NULL);
 
        /*
-        *      If it's an n-ary operation, AND the LHS is the function we're currently using, then just add "rhs" to the
-        *      "lhs" children.
+        *      If it's a logical operator, then perhaps we can
+        *      statically evaluate the arguments, and simplify the
+        *      condition.  If we can't simplify the con
         */
-       if (nary_ops[op] && (lhs->type == XLAT_FUNC) && (lhs->call.func->token == op)) {
-               /*
-                *      Reparse module return codes if necessary.
-                */
-               if (logical_ops[op] && (reparse_rcode(head, &rhs, true) < 0)) {
+       if (logical_ops[op] && (lhs->type == XLAT_FUNC) && (lhs->call.func->token == op)) {
+               if (reparse_rcode(head, &rhs, true) < 0) {
                        fr_sbuff_set(&our_in, &m_rhs);
                        return -fr_sbuff_used(&our_in);
                }