From aa576071afa492b4db1c07917fad287fb17c6cec Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Tue, 3 Aug 2010 19:45:21 +0000 Subject: [PATCH] - Remove a load of unused variables (or variables that are set but never read). - Move some declarations into the correct #ifdef scope. I couldn't compile/test netware, but the changes look obvious enough. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@982016 13f79535-47bb-0310-9956-ffa450edef68 --- modules/aaa/mod_authnz_ldap.c | 3 --- modules/arch/netware/mod_netware.c | 1 - modules/arch/netware/mod_nw_ssl.c | 8 -------- modules/cache/mod_cache.c | 2 -- modules/dav/main/mod_dav.c | 8 +++----- modules/filters/mod_filter.c | 11 +++++++---- modules/filters/mod_include.c | 7 +++---- modules/filters/regexp.c | 2 -- modules/proxy/mod_proxy_fcgi.c | 1 - modules/proxy/proxy_util.c | 5 +++-- 10 files changed, 16 insertions(+), 32 deletions(-) diff --git a/modules/aaa/mod_authnz_ldap.c b/modules/aaa/mod_authnz_ldap.c index 1966556ea5..c075dfdc39 100644 --- a/modules/aaa/mod_authnz_ldap.c +++ b/modules/aaa/mod_authnz_ldap.c @@ -119,13 +119,10 @@ static char *to_charset = NULL; /* UTF-8 identifier derived from the c /* Derive a code page ID give a language name or ID */ static char* derive_codepage_from_lang (apr_pool_t *p, char *language) { - int lang_len; char *charset; if (!language) /* our default codepage */ return apr_pstrdup(p, "ISO-8859-1"); - else - lang_len = strlen(language); charset = (char*) apr_hash_get(charset_conversions, language, APR_HASH_KEY_STRING); diff --git a/modules/arch/netware/mod_netware.c b/modules/arch/netware/mod_netware.c index 138007810f..a93926a6ff 100644 --- a/modules/arch/netware/mod_netware.c +++ b/modules/arch/netware/mod_netware.c @@ -101,7 +101,6 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, char *cmd_only, *ptr; const char *new_cmd; netware_dir_config *d; - apr_file_t *fh; const char *args = ""; d = (netware_dir_config *)ap_get_module_config(r->per_dir_config, diff --git a/modules/arch/netware/mod_nw_ssl.c b/modules/arch/netware/mod_nw_ssl.c index af997717fe..89b0483657 100644 --- a/modules/arch/netware/mod_nw_ssl.c +++ b/modules/arch/netware/mod_nw_ssl.c @@ -233,12 +233,10 @@ static int make_secure_socket(apr_pool_t *pconf, const struct sockaddr_in *serve char* key, int mutual, server_rec *sconf) { int s; - int one = 1; char addr[MAX_ADDRESS]; struct sslserveropts opts; unsigned int optParam; WSAPROTOCOL_INFO SecureProtoInfo; - int no = 1; if (server->sin_addr.s_addr != htonl(INADDR_ANY)) apr_snprintf(addr, sizeof(addr), "address %s port %d", @@ -546,7 +544,6 @@ static const char *set_secure_upgradeable_listener(cmd_parms *cmd, void *dummy, const char *ips, const char* key) { NWSSLSrvConfigRec* sc = get_nwssl_cfg(cmd->server); - seclistenup_rec *listen_node; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); char *ports, *addr; unsigned short port; @@ -626,8 +623,6 @@ static int nwssl_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { seclisten_rec* ap_old_seclisteners; - char *ports, *addr; - unsigned short port; ap_listen_rec **walk; seclisten_rec **secwalk; apr_sockaddr_t *sa; @@ -724,7 +719,6 @@ static int nwssl_post_config(apr_pool_t *pconf, apr_pool_t *plog, ap_listen_rec *walk; seclisten_rec *secwalk, *lastsecwalk; apr_sockaddr_t *sa; - int found_listener = 0; /* Walk the old listeners list and compare it to the secure listeners list and remove any secure listener records that @@ -896,8 +890,6 @@ static int isSecureUpgraded (const request_rec *r) static int nwssl_hook_Fixup(request_rec *r) { - int i; - if (!isSecure(r) && !isSecureUpgraded(r)) return DECLINED; diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 02ba0a61a3..ad87936c46 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -885,7 +885,6 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) * buckets and use their length to calculate the size */ int all_buckets_here=0; - int unresolved_length = 0; size=0; for (e = APR_BRIGADE_FIRST(in); e != APR_BRIGADE_SENTINEL(in); @@ -896,7 +895,6 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) break; } if (APR_BUCKET_IS_FLUSH(e)) { - unresolved_length = 1; continue; } if (e->length == (apr_size_t)-1) { diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index f4461b984d..081d724403 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -1984,7 +1984,6 @@ static int dav_method_propfind(request_rec *r) dav_error *err; int result; apr_xml_doc *doc; - const apr_xml_elem *child; dav_walker_ctx ctx = { { 0 } }; dav_response *multi_status; @@ -2035,15 +2034,14 @@ static int dav_method_propfind(request_rec *r) /* ### validate that only one of these three elements is present */ - if (doc == NULL - || (child = dav_find_child(doc->root, "allprop")) != NULL) { + if (doc == NULL || dav_find_child(doc->root, "allprop") != NULL) { /* note: no request body implies allprop */ ctx.propfind_type = DAV_PROPFIND_IS_ALLPROP; } - else if ((child = dav_find_child(doc->root, "propname")) != NULL) { + else if (dav_find_child(doc->root, "propname") != NULL) { ctx.propfind_type = DAV_PROPFIND_IS_PROPNAME; } - else if ((child = dav_find_child(doc->root, "prop")) != NULL) { + else if (dav_find_child(doc->root, "prop") != NULL) { ctx.propfind_type = DAV_PROPFIND_IS_PROP; } else { diff --git a/modules/filters/mod_filter.c b/modules/filters/mod_filter.c index 16dc662633..3970c836e7 100644 --- a/modules/filters/mod_filter.c +++ b/modules/filters/mod_filter.c @@ -133,16 +133,16 @@ static int filter_init(ap_filter_t *f) static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter) { ap_filter_provider_t *provider; - const char *str = NULL; - char *str1; int match; int err = 0; unsigned int proto_flags; request_rec *r = f->r; harness_ctx *ctx = f->ctx; provider_ctx *pctx; +#ifndef NO_PROTOCOL mod_filter_ctx *rctx = ap_get_module_config(r->request_config, &filter_module); +#endif /* Check registered providers in order */ for (provider = filter->providers; provider; provider = provider->next) { @@ -178,9 +178,10 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter) } if (proto_flags & AP_FILTER_PROTO_TRANSFORM) { - str = apr_table_get(r->headers_out, "Cache-Control"); + const char *str = apr_table_get(r->headers_out, + "Cache-Control"); if (str) { - str1 = apr_pstrdup(r->pool, str); + char *str1 = apr_pstrdup(r->pool, str); ap_str_tolower(str1); if (strstr(str1, "no-transform")) { /* can't use this provider; try next */ @@ -235,8 +236,10 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter) static apr_status_t filter_harness(ap_filter_t *f, apr_bucket_brigade *bb) { apr_status_t ret; +#ifndef NO_PROTOCOL const char *cachecontrol; char *str; +#endif harness_ctx *ctx = f->ctx; ap_filter_rec_t *filter = f->frec; diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 2931b46b01..3921787633 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -3069,10 +3069,6 @@ static apr_status_t includes_filter(ap_filter_t *f, apr_bucket_brigade *b) static int include_fixup(request_rec *r) { - include_dir_config *conf; - - conf = ap_get_module_config(r->per_dir_config, &include_module); - if (r->handler && (strcmp(r->handler, "server-parsed") == 0)) { if (!r->content_type || !*r->content_type) { @@ -3088,6 +3084,9 @@ static int include_fixup(request_rec *r) } #else { + include_dir_config *conf = ap_get_module_config(r->per_dir_config, + &include_module); + if (conf->xbithack == XBITHACK_OFF) { return DECLINED; } diff --git a/modules/filters/regexp.c b/modules/filters/regexp.c index 51a7ec9d5a..a0f170bdb0 100644 --- a/modules/filters/regexp.c +++ b/modules/filters/regexp.c @@ -142,7 +142,6 @@ char *sed_compile(sed_commands_t *commands, sed_comp_args *compargs, int lc; int i, cflg; int iflag; /* used for non-ascii characters in brackets */ - int nodelim = 0; char *sp = commands->cp; int regerrno = 0; @@ -150,7 +149,6 @@ char *sed_compile(sed_commands_t *commands, sed_comp_args *compargs, if ((c = GETC()) == eof || c == '\n') { if (c == '\n') { UNGETC(c); - nodelim = 1; } commands->cp = sp; goto out; diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c index 3fad127e68..3e8fdb5293 100644 --- a/modules/proxy/mod_proxy_fcgi.c +++ b/modules/proxy/mod_proxy_fcgi.c @@ -517,7 +517,6 @@ static void dump_header_to_log(request_rec *r, unsigned char fheader[], while (posn < length) { unsigned char c = fheader[posn]; - char hexval[3]; if (i >= 20) { i = 0; diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index a6e8682399..abc8de4831 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -59,10 +59,11 @@ APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, create_req, /* already called in the knowledge that the characters are hex digits */ PROXY_DECLARE(int) ap_proxy_hex2c(const char *x) { - int i, ch; + int i; #if !APR_CHARSET_EBCDIC - ch = x[0]; + int ch = x[0]; + if (apr_isdigit(ch)) { i = ch - '0'; }