]> granicus.if.org Git - apache/commitdiff
dav_resource should carry around a pool for allocations related to it
authorGreg Stein <gstein@apache.org>
Thu, 23 Nov 2000 11:44:22 +0000 (11:44 +0000)
committerGreg Stein <gstein@apache.org>
Thu, 23 Nov 2000 11:44:22 +0000 (11:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87074 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/fs/repos.c
modules/dav/main/mod_dav.h

index 9c17270b585553e4a2741ec50c6aef49722dbd46..c168d2a9f20b91ec95571a0de111ff224551d1a4 100644 (file)
@@ -616,9 +616,11 @@ static dav_resource * dav_fs_get_resource(
 
     /* Create private resource context descriptor */
     ctx = apr_pcalloc(r->pool, sizeof(*ctx));
-    ctx->pool = r->pool;
     ctx->finfo = r->finfo;
 
+    /* ### this should go away */
+    ctx->pool = r->pool;
+
     /* Preserve case on OSes which fold canonical filenames */
 #if 0
     /* ### not available in Apache 2.0 yet */
@@ -647,6 +649,7 @@ static dav_resource * dav_fs_get_resource(
     resource->type = DAV_RESOURCE_TYPE_REGULAR;
     resource->info = ctx;
     resource->hooks = &dav_hooks_repository_fs;
+    resource->pool = r->pool;
 
     /* make sure the URI does not have a trailing "/" */
     len = strlen(r->uri);
@@ -719,6 +722,8 @@ static dav_resource * dav_fs_get_parent_resource(const dav_resource *resource)
 
     /* Create private resource context descriptor */
     parent_ctx = apr_pcalloc(ctx->pool, sizeof(*parent_ctx));
+
+    /* ### this should go away */
     parent_ctx->pool = ctx->pool;
 
     dirpath = ap_make_dirstr_parent(ctx->pool, ctx->pathname);
@@ -730,6 +735,7 @@ static dav_resource * dav_fs_get_parent_resource(const dav_resource *resource)
     parent_resource->info = parent_ctx;
     parent_resource->collection = 1;
     parent_resource->hooks = &dav_hooks_repository_fs;
+    parent_resource->pool = resource->pool;
 
     if (resource->uri != NULL) {
         char *uri = ap_make_dirstr_parent(ctx->pool, resource->uri);
@@ -1604,6 +1610,7 @@ static dav_error * dav_fs_internal_walk(const dav_walk_params *params,
     /* ### zero out versioned, working, baselined? */
 
     fsctx.res1 = *params->root;
+    fsctx.res1.pool = params->pool;
 
     fsctx.res1.info = &fsctx.info1;
     fsctx.info1 = *params->root->info;
@@ -1625,6 +1632,7 @@ static dav_error * dav_fs_internal_walk(const dav_walk_params *params,
        fsctx.res2.exists = 0;
        fsctx.res2.collection = 0;
         fsctx.res2.uri = NULL;          /* we don't track this */
+        fsctx.res2.pool = params->pool;
 
        fsctx.res2.info = &fsctx.info2;
        fsctx.info2 = *root_dst->info;
index ef2e4c0cbfca09b19ef51b4abd9229e34809d988..7f876d5fe03087d6d75f7ee035b18f36f61aa50e 100644 (file)
@@ -393,6 +393,11 @@ typedef struct dav_resource {
 
     const dav_hooks_repository *hooks; /* hooks used for this resource */
 
+    /* When allocating items related specifically to this resource, the
+       following pool should be used. Its lifetime will be at least as
+       long as the dav_resource structure. */
+    apr_pool_t *pool;
+
 } dav_resource;
 
 /*