summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2010-11-06 23:12:41 +0100
committerStefan Fritsch <sf@apache.org>2010-11-06 23:12:41 +0100
commit286c8622b6c3a85d59ac47c6df857a298b222d6a (patch)
tree41f41265329d1ce9e1600cd40e0d8337c4006b96 /server
parentNetware build fixes (diff)
downloadapache2-286c8622b6c3a85d59ac47c6df857a298b222d6a.tar.xz
apache2-286c8622b6c3a85d59ac47c6df857a298b222d6a.zip
Add a generic pool cleanup function that sets a pointer to NULL and use
it to replace various pool cleanup functions. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032167 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/config.c8
-rw-r--r--server/log.c12
-rw-r--r--server/util.c6
-rw-r--r--server/util_mutex.c9
4 files changed, 10 insertions, 25 deletions
diff --git a/server/config.c b/server/config.c
index a1fb2c9d1a..7c01b5b257 100644
--- a/server/config.c
+++ b/server/config.c
@@ -471,19 +471,13 @@ struct ap_mod_list_struct {
const command_rec *cmd;
};
-static apr_status_t reload_conf_hash(void *baton)
-{
- ap_config_hash = NULL;
- return APR_SUCCESS;
-}
-
static void rebuild_conf_hash(apr_pool_t *p, int add_prelinked)
{
module **m;
ap_config_hash = apr_hash_make(p);
- apr_pool_cleanup_register(p, NULL, reload_conf_hash,
+ apr_pool_cleanup_register(p, &ap_config_hash, ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
if (add_prelinked) {
for (m = ap_prelinked_modules; *m != NULL; m++) {
diff --git a/server/log.c b/server/log.c
index 4b23d742bf..ec0a92aea1 100644
--- a/server/log.c
+++ b/server/log.c
@@ -196,16 +196,6 @@ AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl)
return pl->write_fd;
}
-/* clear_handle_list() is called when plog is cleared; at that
- * point we need to forget about our old list of pipe read
- * handles. We let the plog cleanups close the actual pipes.
- */
-static apr_status_t clear_handle_list(void *v)
-{
- read_handles = NULL;
- return APR_SUCCESS;
-}
-
/* remember to close this handle in the child process
*
* On Win32 this makes zero sense, because we don't
@@ -459,7 +449,7 @@ int ap_open_logs(apr_pool_t *pconf, apr_pool_t *p /* plog */,
* between log phases, so we don't mind losing stderr's
* read_handle a little bit early.
*/
- apr_pool_cleanup_register(p, NULL, clear_handle_list,
+ apr_pool_cleanup_register(p, &read_handles, ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
/* HERE we need a stdout log that outlives plog.
diff --git a/server/util.c b/server/util.c
index faeda43c50..c4799b3933 100644
--- a/server/util.c
+++ b/server/util.c
@@ -2248,3 +2248,9 @@ AP_DECLARE(int) ap_request_has_body(request_rec *r)
);
return has_body;
}
+
+AP_DECLARE(apr_status_t) ap_pool_cleanup_set_null(void *data_)
+{
+ void **ptr = (void **)data_;
+ *ptr = NULL;
+}
diff --git a/server/util_mutex.c b/server/util_mutex.c
index ad3833b14f..d3f6674af5 100644
--- a/server/util_mutex.c
+++ b/server/util_mutex.c
@@ -139,12 +139,6 @@ typedef struct {
*/
static apr_hash_t *mxcfg_by_type;
-static apr_status_t cleanup_mx_hash(void *dummy)
-{
- mxcfg_by_type = NULL;
- return APR_SUCCESS;
-}
-
AP_DECLARE_NONSTD(void) ap_mutex_init(apr_pool_t *p)
{
mutex_cfg_t *def;
@@ -154,7 +148,8 @@ AP_DECLARE_NONSTD(void) ap_mutex_init(apr_pool_t *p)
}
mxcfg_by_type = apr_hash_make(p);
- apr_pool_cleanup_register(p, NULL, cleanup_mx_hash, apr_pool_cleanup_null);
+ apr_pool_cleanup_register(p, &mxcfg_by_type, ap_pool_cleanup_set_null,
+ apr_pool_cleanup_null);
/* initialize default mutex configuration */
def = apr_pcalloc(p, sizeof *def);