httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rici Lake <r...@ricilake.net>
Subject For review: teach mod_include.c to recycle brigades
Date Mon, 25 Apr 2005 21:09:05 GMT
Index: mod_include.c
===================================================================
--- mod_include.c       (revision 158730)
+++ mod_include.c       (working copy)
@@ -3060,7 +3060,7 @@
      struct ssi_internal_ctx *intern = ctx->intern;
      request_rec *r = f->r;
      apr_bucket *b = APR_BRIGADE_FIRST(bb);
-    apr_bucket_brigade *pass_bb;
+    apr_bucket_brigade *pass_bb = ctx->pass_bb;
      apr_status_t rv = APR_SUCCESS;
      char *magic; /* magic pointer for sentinel use */

@@ -3076,9 +3076,6 @@
          return ap_pass_brigade(f->next, bb);
      }

-    /* All stuff passed along has to be put into that brigade */
-    pass_bb = apr_brigade_create(ctx->pool, f->c->bucket_alloc);
-
      /* initialization for this loop */
      intern->bytes_read = 0;
      intern->error = 0;
@@ -3145,7 +3142,6 @@
              if (!APR_BRIGADE_EMPTY(pass_bb)) {
                  rv = ap_pass_brigade(f->next, pass_bb);
                  if (rv != APR_SUCCESS) {
-                    apr_brigade_destroy(pass_bb);
                      return rv;
                  }
              }
@@ -3170,7 +3166,7 @@
              }

              if (rv != APR_SUCCESS) {
-                apr_brigade_destroy(pass_bb);
+                apr_brigade_cleanup(pass_bb);
                  return rv;
              }

@@ -3384,7 +3380,7 @@
                      DEBUG_INIT(ctx, f, pass_bb);
                      rv = handle_func(ctx, f, pass_bb);
                      if (rv != APR_SUCCESS) {
-                        apr_brigade_destroy(pass_bb);
+                        apr_brigade_cleanup(pass_bb);
                          return rv;
                      }
                  }
@@ -3450,13 +3446,11 @@

      /* if something's left over, pass it along */
      if (!APR_BRIGADE_EMPTY(pass_bb)) {
-        rv = ap_pass_brigade(f->next, pass_bb);
+        return ap_pass_brigade(f->next, pass_bb);
      }
      else {
-        rv = APR_SUCCESS;
-        apr_brigade_destroy(pass_bb);
+        return APR_SUCCESS;
      }
-    return rv;
  }


@@ -3542,8 +3536,11 @@
          intern->end_seq_len = strlen(intern->end_seq);
          intern->undefined_echo = conf->undefined_echo;
          intern->undefined_echo_len = strlen(conf->undefined_echo);
+
+        /* Initialize the pass brigade */
+        ctx->pass_bb = apr_brigade_create(f->r->pool, 
f->c->bucket_alloc);
      }

      if ((parent = ap_get_module_config(r->request_config, 
&include_module))) {
          /* Kludge --- for nested includes, we want to keep the 
subprocess
           * environment of the base document (for compatibility); that 
means
@@ -3599,6 +3596,6 @@
          apr_table_setn(r->subprocess_env, "QUERY_STRING_UNESCAPED",
                    ap_escape_shell_cmd(r->pool, arg_copy));
      }

      return send_parsed_content(f, b);
  }
Index: mod_include.h
===================================================================
--- mod_include.h       (revision 158730)
+++ mod_include.h       (working copy)
@@ -85,6 +85,9 @@
      /* currently configured time format */
      const char  *time_str;

+    /* bucket brigade for passing to next filter */
+    apr_bucket_brigade *pass_bb;
+
      /* pointer to internal (non-public) data, don't touch */
      struct ssi_internal_ctx *intern;
  } include_ctx_t;


Mime
View raw message