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 Mon, 25 Aug 2003 22:06:45 GMT
nd          2003/08/25 15:06:45

  Modified:    modules/filters mod_include.c
  Log:
  readability improvement. Handle the case of the current token being the
  first parsed explicitly. There's probably also a minor performance improvement
  on invalid expressions ... ;-)
  
  Revision  Changes    Path
  1.269     +17 -33    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.268
  retrieving revision 1.269
  diff -u -r1.268 -r1.269
  --- mod_include.c	25 Aug 2003 21:22:37 -0000	1.268
  +++ mod_include.c	25 Aug 2003 22:06:45 -0000	1.269
  @@ -1144,13 +1144,26 @@
           DEBUG_DUMP_UNMATCHED(ctx, was_unmatched);
           DEBUG_DUMP_TOKEN(ctx, &new->token);
   
  -        switch (new->token.type) {
  -        case TOKEN_STRING:
  -            if (!current) {
  +        if (!current) {
  +            switch (new->token.type) {
  +            case TOKEN_STRING:
  +            case TOKEN_RE:
  +            case TOKEN_NOT:
  +            case TOKEN_LBRACE:
                   root = current = new;
  -                break;
  +                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;
               }
  +        }
   
  +        switch (new->token.type) {
  +        case TOKEN_STRING:
               switch (current->token.type) {
               case TOKEN_STRING:
                   current->token.value =
  @@ -1176,11 +1189,6 @@
               break;
   
           case TOKEN_RE:
  -            if (!current) {
  -                root = current = new;
  -                break;
  -            }
  -
               switch (current->token.type) {
               case TOKEN_EQ:
               case TOKEN_NE:
  @@ -1204,13 +1212,6 @@
   
           case TOKEN_AND:
           case TOKEN_OR:
  -            if (!current) {
  -                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -                              "Invalid expression \"%s\" in file %s",
  -                              expr, r->filename);
  -                *was_error = 1;
  -                return retval;
  -            }
               /* Percolate upwards */
               while (current) {
                   switch (current->token.type) {
  @@ -1247,11 +1248,6 @@
               break;
   
           case TOKEN_NOT:
  -            if (!current) {
  -                root = current = new;
  -                break;
  -            }
  -
               switch (current->token.type) {
               case TOKEN_STRING:
               case TOKEN_RE:
  @@ -1277,13 +1273,6 @@
           case TOKEN_GT:
           case TOKEN_LE:
           case TOKEN_LT:
  -            if (!current) {
  -                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -                              "Invalid expression \"%s\" in file %s",
  -                              expr, r->filename);
  -                *was_error = 1;
  -                return retval;
  -            }
               /* Percolate upwards */
               while (current) {
                   switch (current->token.type) {
  @@ -1341,11 +1330,6 @@
               break;
   
           case TOKEN_LBRACE:
  -            if (!current) {
  -                root = current = new;
  -                break;
  -            }
  -
               switch (current->token.type) {
               case TOKEN_STRING:
               case TOKEN_RE:
  
  
  

Mime
View raw message