summaryrefslogtreecommitdiffstats
path: root/modules/session
diff options
context:
space:
mode:
authorJacob Champion <jchampion@apache.org>2016-11-10 21:53:21 +0100
committerJacob Champion <jchampion@apache.org>2016-11-10 21:53:21 +0100
commit091f96ee10e3963faacd258c3f64417c7ad21e1c (patch)
treeffd8ec24d41ec9a54cf20c7580aaa0ce3ce673fd /modules/session
parentheh... bring memcache up to redis :) (diff)
downloadapache2-091f96ee10e3963faacd258c3f64417c7ad21e1c.tar.xz
apache2-091f96ee10e3963faacd258c3f64417c7ad21e1c.zip
Remove unnecessary apr_table_do() function casts
Function casts can cause hard-to-debug corruption issues if a declaration is accidentally changed to be incompatible. Luckily, most of the function casts for apr_table_do() calls are unnecessary. Remove them, and adjust the signatures for helpers that weren't taking void* as the first argument. The remaining helper that requires a cast is http_filter.c's form_header_field(), which is probably where many of these casts were copy-pasted from. I have left it as-is: it has other direct callers besides apr_table_do(), and it's already documented with warnings not to change the function signature. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1769192 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/session')
-rw-r--r--modules/session/mod_session.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/session/mod_session.c b/modules/session/mod_session.c
index 9761e50669..c573f981a7 100644
--- a/modules/session/mod_session.c
+++ b/modules/session/mod_session.c
@@ -311,15 +311,16 @@ static apr_status_t ap_session_set(request_rec * r, session_rec * z,
return APR_SUCCESS;
}
-static int identity_count(int *count, const char *key, const char *val)
+static int identity_count(void *v, const char *key, const char *val)
{
+ int *count = v;
*count += strlen(key) * 3 + strlen(val) * 3 + 1;
return 1;
}
-static int identity_concat(char *buffer, const char *key, const char *val)
+static int identity_concat(void *v, const char *key, const char *val)
{
- char *slider = buffer;
+ char *slider = v;
int length = strlen(slider);
slider += length;
if (length) {
@@ -356,11 +357,9 @@ static apr_status_t session_identity_encode(request_rec * r, session_rec * z)
char *expiry = apr_psprintf(z->pool, "%" APR_INT64_T_FMT, z->expiry);
apr_table_setn(z->entries, SESSION_EXPIRY, expiry);
}
- apr_table_do((int (*) (void *, const char *, const char *))
- identity_count, &length, z->entries, NULL);
+ apr_table_do(identity_count, &length, z->entries, NULL);
buffer = apr_pcalloc(r->pool, length + 1);
- apr_table_do((int (*) (void *, const char *, const char *))
- identity_concat, buffer, z->entries, NULL);
+ apr_table_do(identity_concat, buffer, z->entries, NULL);
z->encoded = buffer;
return OK;