httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/filters mod_include.c
Date Wed, 27 Aug 2003 19:32:36 GMT
nd          2003/08/27 12:32:36

  Modified:    modules/filters mod_include.c
  Log:
  TOKEN_GROUP is nothing but an identity operator, it gateways the
  result of the enclosed expression. Since this expression will never
  touched again during the tree-building stage, we can safely strip
  TOKEN_GROUP from the tree and later evaluate the child directly.
  
  The only side effect of this change is, that grouped strings on the
  left side of EQ/NE/etc are now allowed (was invalid before), which
  is acceptable IMHO (e.g. (foo bar baz) = zzzip)
  
  Revision  Changes    Path
  1.277     +19 -34    httpd-2.0/modules/filters/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
  retrieving revision 1.276
  retrieving revision 1.277
  diff -u -r1.276 -r1.277
  --- mod_include.c	27 Aug 2003 18:00:47 -0000	1.276
  +++ mod_include.c	27 Aug 2003 19:32:35 -0000	1.277
  @@ -126,7 +126,6 @@
       TOKEN_NE,
       TOKEN_RBRACE,
       TOKEN_LBRACE,
  -    TOKEN_GROUP,
       TOKEN_GE,
       TOKEN_LE,
       TOKEN_GT,
  @@ -336,7 +335,6 @@
               continue;
   
           case TOKEN_NOT:
  -        case TOKEN_GROUP:
           case TOKEN_RBRACE:
           case TOKEN_LBRACE:
               if (!current->dump_done) {
  @@ -1213,8 +1211,7 @@
                   break;
   
               case TOKEN_RE:
  -            case TOKEN_RBRACE:
  -            case TOKEN_GROUP:
  +            case TOKEN_RBRACE: /* cannot happen */
                   ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                                 "Invalid expression \"%s\" in file %s",
                                 expr, r->filename);
  @@ -1333,7 +1330,23 @@
                   return retval;
               }
   
  -            TYPE_TOKEN(&current->token, TOKEN_GROUP);
  +            /* empty groups return TRUE (backwards compat) */
  +            if (!current->right) {
  +                CREATE_NODE(ctx, current->right);
  +                TYPE_TOKEN(&current->right->token, TOKEN_STRING);
  +                current->right->token.value = "()";
  +            }
  +
  +            current->right->parent = current->parent;
  +            if (!current->parent) {
  +                current = root = current->right;
  +            }
  +            else if (current->parent->left == current) {
  +                current = current->parent->left = current->right;
  +            }
  +            else {
  +                current = current->parent->right = current->right;
  +            }
               break;
   
           case TOKEN_NOT:
  @@ -1341,8 +1354,7 @@
               switch (current->token.type) {
               case TOKEN_STRING:
               case TOKEN_RE:
  -            case TOKEN_RBRACE:
  -            case TOKEN_GROUP:
  +            case TOKEN_RBRACE: /* cannot happen */
                   ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                                 "Invalid expression \"%s\" in file %s",
                                 expr, r->filename);
  @@ -1357,9 +1369,6 @@
               new->parent = current;
               current = new;
               break;
  -
  -        default:
  -            break;
           }
       }
   
  @@ -1560,33 +1569,9 @@
               current = current->parent;
               break;
   
  -        case TOKEN_GROUP:
  -            if (current->right) {
  -                if (!current->right->done) {
  -                    current = current->right;
  -                    continue;
  -                }
  -                current->value = current->right->value;
  -            }
  -            else {
  -                current->value = 1;
  -            }
  -
  -            DEBUG_DUMP_EVAL(ctx, current);
  -            current->done = 1;
  -            current = current->parent;
  -            break;
  -
           case TOKEN_LBRACE:
               ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                             "Unmatched '(' in \"%s\" in file %s",
  -                          expr, r->filename);
  -            *was_error = 1;
  -            return retval;
  -
  -        case TOKEN_RBRACE:
  -            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -                          "Unmatched ')' in \"%s\" in file %s",
                             expr, r->filename);
               *was_error = 1;
               return retval;
  
  
  

Mime
View raw message