diff options
author | Joe Orton <jorton@apache.org> | 2008-04-08 15:49:52 +0200 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2008-04-08 15:49:52 +0200 |
commit | 39bb462ea864effe76cd3a1e05ff9f53f2bbaad0 (patch) | |
tree | 1948a20d36de04b9b794b454fd312aced47b4d13 /modules/cache/mod_socache_dbm.c | |
parent | * Fix eol-style property. (diff) | |
download | apache2-39bb462ea864effe76cd3a1e05ff9f53f2bbaad0.tar.xz apache2-39bb462ea864effe76cd3a1e05ff9f53f2bbaad0.zip |
* modules/cache/ap_socache.h: Add ap_socache_instance_t object type.
Adjust the provider interface to use this instance type throughout.
* modules/cache/mod_socache_dbm.c,
modules/cache/mod_socache_memcache.c,
modules/cache/mod_socache_shmcb.c,
modules/cache/mod_socache_dc.c: Adjust all implementations to
define the instance object in place of the "struct context", and
to take this object directly in the provider interface.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645924 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cache/mod_socache_dbm.c')
-rw-r--r-- | modules/cache/mod_socache_dbm.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/modules/cache/mod_socache_dbm.c b/modules/cache/mod_socache_dbm.c index 5400d10a9c..0228c96f29 100644 --- a/modules/cache/mod_socache_dbm.c +++ b/modules/cache/mod_socache_dbm.c @@ -36,7 +36,7 @@ /* Use of the context structure must be thread-safe after the initial * create/init; callers must hold the mutex. */ -struct context { +struct ap_socache_instance_t { const char *data_file; /* Pool must only be used with the mutex held. */ apr_pool_t *pool; @@ -63,18 +63,17 @@ struct context { #endif #endif +static void socache_dbm_expire(ap_socache_instance_t *ctx, server_rec *s); - -static void socache_dbm_expire(struct context *ctx, server_rec *s); - -static void socache_dbm_remove(void *context, server_rec *s, +static void socache_dbm_remove(ap_socache_instance_t *ctx, server_rec *s, const unsigned char *id, unsigned int idlen, apr_pool_t *p); -static const char *socache_dbm_create(void **context, const char *arg, +static const char *socache_dbm_create(ap_socache_instance_t **context, + const char *arg, apr_pool_t *tmp, apr_pool_t *p) { - struct context *ctx; + ap_socache_instance_t *ctx; *context = ctx = apr_pcalloc(p, sizeof *ctx); @@ -88,9 +87,9 @@ static const char *socache_dbm_create(void **context, const char *arg, return NULL; } -static apr_status_t socache_dbm_init(void *context, server_rec *s, apr_pool_t *p) +static apr_status_t socache_dbm_init(ap_socache_instance_t *ctx, + server_rec *s, apr_pool_t *p) { - struct context *ctx = context; apr_dbm_t *dbm; apr_status_t rv; @@ -142,10 +141,8 @@ static apr_status_t socache_dbm_init(void *context, server_rec *s, apr_pool_t *p return APR_SUCCESS; } -static void socache_dbm_kill(void *context, server_rec *s) +static void socache_dbm_kill(ap_socache_instance_t *ctx, server_rec *s) { - struct context *ctx = context; - /* the correct way */ unlink(apr_pstrcat(ctx->pool, ctx->data_file, SSL_DBM_FILE_SUFFIX_DIR, NULL)); unlink(apr_pstrcat(ctx->pool, ctx->data_file, SSL_DBM_FILE_SUFFIX_PAG, NULL)); @@ -158,12 +155,11 @@ static void socache_dbm_kill(void *context, server_rec *s) return; } -static apr_status_t socache_dbm_store(void *context, server_rec *s, - const unsigned char *id, unsigned int idlen, - time_t expiry, - unsigned char *ucaData, unsigned int nData) +static apr_status_t socache_dbm_store( + ap_socache_instance_t *ctx, server_rec *s, + const unsigned char *id, unsigned int idlen, + time_t expiry, unsigned char *ucaData, unsigned int nData) { - struct context *ctx = context; apr_dbm_t *dbm; apr_datum_t dbmkey; apr_datum_t dbmval; @@ -232,12 +228,12 @@ static apr_status_t socache_dbm_store(void *context, server_rec *s, return APR_SUCCESS; } -static apr_status_t socache_dbm_retrieve(void *context, server_rec *s, - const unsigned char *id, unsigned int idlen, - unsigned char *dest, unsigned int *destlen, - apr_pool_t *p) +static apr_status_t socache_dbm_retrieve( + ap_socache_instance_t *ctx, server_rec *s, + const unsigned char *id, unsigned int idlen, + unsigned char *dest, unsigned int *destlen, + apr_pool_t *p) { - struct context *ctx = context; apr_dbm_t *dbm; apr_datum_t dbmkey; apr_datum_t dbmval; @@ -299,11 +295,10 @@ static apr_status_t socache_dbm_retrieve(void *context, server_rec *s, return APR_SUCCESS; } -static void socache_dbm_remove(void *context, server_rec *s, +static void socache_dbm_remove(ap_socache_instance_t *ctx, server_rec *s, const unsigned char *id, unsigned int idlen, apr_pool_t *p) { - struct context *ctx = context; apr_dbm_t *dbm; apr_datum_t dbmkey; apr_status_t rv; @@ -329,7 +324,7 @@ static void socache_dbm_remove(void *context, server_rec *s, return; } -static void socache_dbm_expire(struct context *ctx, server_rec *s) +static void socache_dbm_expire(ap_socache_instance_t *ctx, server_rec *s) { apr_dbm_t *dbm; apr_datum_t dbmkey; @@ -436,9 +431,9 @@ static void socache_dbm_expire(struct context *ctx, server_rec *s) nElements, nElements-nDeleted, nDeleted); } -static void socache_dbm_status(void *context, request_rec *r, int flags) +static void socache_dbm_status(ap_socache_instance_t *ctx, request_rec *r, + int flags) { - struct context *ctx = context; apr_dbm_t *dbm; apr_datum_t dbmkey; apr_datum_t dbmval; |