From: Joe Orton Date: Wed, 19 May 2010 13:15:21 +0000 (+0000) Subject: * modules/metadata/mod_headers.c: Add a function pointer type for X-Git-Tag: 2.3.6~102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e588bbc955ad37e3a0e798c86b92d596ab13129b;p=apache * modules/metadata/mod_headers.c: Add a function pointer type for the tag handler callback to regain some type-safety. (register_format_tag_handler, header_pre_config): Adjusted. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@946173 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index ad6fde7148..cbbe2d9153 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -106,12 +106,15 @@ static char hdr_in = '0'; /* RequestHeader */ static char hdr_out = '1'; /* Header onsuccess */ static char hdr_err = '2'; /* Header always */ +/* Callback function type. */ +typedef const char *format_tag_fn(request_rec *r, char *a); + /* * There is an array of struct format_tag per Header/RequestHeader * config directive */ typedef struct { - const char* (*func)(request_rec *r,char *arg); + format_tag_fn *func; char *arg; } format_tag; @@ -867,7 +870,7 @@ static const command_rec headers_cmds[] = }; static void register_format_tag_handler(const char *tag, - const void *tag_handler) + format_tag_fn *tag_handler) { apr_hash_set(format_tag_hash, tag, 1, tag_handler); } @@ -875,10 +878,10 @@ static void register_format_tag_handler(const char *tag, static int header_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) { format_tag_hash = apr_hash_make(p); - register_format_tag_handler("D", (const void *)header_request_duration); - register_format_tag_handler("t", (const void *)header_request_time); - register_format_tag_handler("e", (const void *)header_request_env_var); - register_format_tag_handler("s", (const void *)header_request_ssl_var); + register_format_tag_handler("D", header_request_duration); + register_format_tag_handler("t", header_request_time); + register_format_tag_handler("e", header_request_env_var); + register_format_tag_handler("s", header_request_ssl_var); return OK; }