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 Tue, 26 Aug 2003 00:32:03 GMT
nd          2003/08/25 17:32:03

  Modified:    modules/filters mod_include.c
  Log:
  since our parse tree is left-weighted, the short circuit evaluation
  is way more useful if we short circuit the left side. So evaluate
  the right side first. This, however, reverses my statement about
  regex optimization (you have to put them onto the right side of an
  && or || operator to get a chance that the left side will be cutted).
  
  Revision  Changes    Path
  1.272     +21 -20    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.271
  retrieving revision 1.272
  diff -u -r1.271 -r1.272
  --- mod_include.c	25 Aug 2003 23:37:47 -0000	1.271
  +++ mod_include.c	26 Aug 2003 00:32:03 -0000	1.272
  @@ -1365,50 +1365,51 @@
                   *was_error = 1;
                   return retval;
               }
  -            if (!current->left->done) {
  -                switch (current->left->token.type) {
  +
  +            if (!current->right->done) {
  +                switch (current->right->token.type) {
                   case TOKEN_STRING:
                       buffer = ap_ssi_parse_string(ctx,
  -                                                 current->left->token.value,
  +                                                 current->right->token.value,
                                                    NULL, 0, SSI_EXPAND_DROP_NAME);
   
  -                    current->left->token.value = buffer;
  -                    current->left->value = !!*current->left->token.value;
  -                    current->left->done = 1;
  +                    current->right->token.value = buffer;
  +                    current->right->value = !!*current->right->token.value;
  +                    current->right->done = 1;
                       break;
   
                   default:
  -                    current = current->left;
  +                    current = current->right;
                       continue;
                   }
               }
   
               /* short circuit evaluation */
  -            if (!current->right->done && !regex &&
  -                ((current->token.type == TOKEN_AND && !current->left->value)
||
  -                (current->token.type == TOKEN_OR && current->left->value)))
{
  -                DEBUG_PRINTF((ctx, "     Left: %c\n", current->left->value
  +            if (!current->left->done && !regex &&
  +                ((current->token.type == TOKEN_AND && !current->right->value)
||
  +                (current->token.type == TOKEN_OR && current->right->value)))
{
  +                DEBUG_PRINTF((ctx, "     Left: short circuited\n"));
  +                DEBUG_PRINTF((ctx, "     Right: %c\n", current->right->value
                                                                     ? '1' : '0'));
  -                DEBUG_PRINTF((ctx, "     Right: short circuited\n"));
   
  -                current->value = current->left->value;
  +                current->value = current->right->value;
               }
               else {
  -                if (!current->right->done) {
  -                    switch (current->right->token.type) {
  +                if (!current->left->done) {
  +                    switch (current->left->token.type) {
                       case TOKEN_STRING:
                           buffer = ap_ssi_parse_string(ctx,
  -                                                     current->right->token.value,
  +                                                     current->left->token.value,
                                                        NULL, 0,
                                                        SSI_EXPAND_DROP_NAME);
   
  -                        current->right->token.value = buffer;
  -                        current->right->value = !!*current->right->token.value;
  -                        current->right->done = 1;
  +                        current->left->token.value = buffer;
  +                        current->left->value = !!*current->left->token.value;
  +                        current->left->done = 1;
                           break;
   
                       default:
  -                        current = current->right;
  +                        current = current->left;
                           continue;
                       }
                   }
  
  
  

Mime
View raw message