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 18:00:47 GMT
nd          2003/08/27 11:00:47

  Modified:    modules/filters mod_include.c
  Log:
  cleanup TOKEN_EQ, NE, LT & co tree generator:
  - the left side of such an operator can *only* be a string
  - get a rid of the while-loop and re-organize the code
    to better reflect what we're actually doing there
  
  Revision  Changes    Path
  1.276     +20 -28    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.275
  retrieving revision 1.276
  diff -u -r1.275 -r1.276
  --- mod_include.c	27 Aug 2003 15:35:13 -0000	1.275
  +++ mod_include.c	27 Aug 2003 18:00:47 -0000	1.276
  @@ -1289,44 +1289,36 @@
           case TOKEN_GT:
           case TOKEN_LE:
           case TOKEN_LT:
  -            /* Percolate upwards */
  -            while (current) {
  -                switch (current->token.type) {
  -                case TOKEN_STRING:
  -                case TOKEN_RE:
  -                case TOKEN_GROUP:
  -                    current = current->parent;
  +            if (current->token.type == TOKEN_STRING) {
  +                current = current->parent;
  +
  +                if (!current) {
  +                    new->left = root;
  +                    root->parent = new;
  +                    current = root = new;
                       continue;
  +                }
   
  +                switch (current->token.type) {
                   case TOKEN_LBRACE:
                   case TOKEN_AND:
                   case TOKEN_OR:
  -                    break;
  +                    new->left = current->right;
  +                    new->left->parent = new;
  +                    new->parent = current;
  +                    current = current->right = new;
  +                    continue;
   
                   default:
  -                    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -                                  "Invalid expression \"%s\" in file %s",
  -                                  expr, r->filename);
  -                    *was_error = 1;
  -                    return retval;
  +                    break;
                   }
  -                break;
               }
   
  -            if (!current) {
  -                new->left = root;
  -                new->left->parent = new;
  -                new->parent = NULL;
  -                root = new;
  -            }
  -            else {
  -                new->left = current->right;
  -                new->left->parent = new;
  -                current->right = new;
  -                new->parent = current;
  -            }
  -            current = new;
  -            break;
  +            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  +                          "Invalid expression \"%s\" in file %s",
  +                          expr, r->filename);
  +            *was_error = 1;
  +            return retval;
   
           case TOKEN_RBRACE:
               while (current && current->token.type != TOKEN_LBRACE) {
  
  
  

Mime
View raw message