Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2A06217A2D for ; Sat, 4 Oct 2014 20:03:32 +0000 (UTC) Received: (qmail 61206 invoked by uid 500); 4 Oct 2014 20:03:31 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 61134 invoked by uid 500); 4 Oct 2014 20:03:31 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 61125 invoked by uid 99); 4 Oct 2014 20:03:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Oct 2014 20:03:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Oct 2014 20:03:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 62BBD23888D7; Sat, 4 Oct 2014 20:03:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1629440 - /httpd/httpd/trunk/modules/aaa/mod_allowmethods.c Date: Sat, 04 Oct 2014 20:03:07 -0000 To: cvs@httpd.apache.org From: jailletc36@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141004200307.62BBD23888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jailletc36 Date: Sat Oct 4 20:03:06 2014 New Revision: 1629440 URL: http://svn.apache.org/r1629440 Log: Style (mostly indent) remove a useless local variable initialization Modified: httpd/httpd/trunk/modules/aaa/mod_allowmethods.c Modified: httpd/httpd/trunk/modules/aaa/mod_allowmethods.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_allowmethods.c?rev=1629440&r1=1629439&r2=1629440&view=diff ============================================================================== --- httpd/httpd/trunk/modules/aaa/mod_allowmethods.c (original) +++ httpd/httpd/trunk/modules/aaa/mod_allowmethods.c Sat Oct 4 20:03:06 2014 @@ -44,110 +44,114 @@ */ typedef struct am_conf_t { - int allowed_set; - apr_int64_t allowed; + int allowed_set; + apr_int64_t allowed; } am_conf_t; module AP_MODULE_DECLARE_DATA allowmethods_module; static int am_check_access(request_rec *r) { - int method = r->method_number; - am_conf_t *conf; + int method = r->method_number; + am_conf_t *conf; - conf = (am_conf_t *) ap_get_module_config(r->per_dir_config, - &allowmethods_module); - if (!conf || conf->allowed == 0) { - return DECLINED; - } - - r->allowed = conf->allowed; - - if (conf->allowed & (AP_METHOD_BIT << method)) { - return DECLINED; - } + conf = (am_conf_t *) ap_get_module_config(r->per_dir_config, + &allowmethods_module); + if (!conf || conf->allowed == 0) { + return DECLINED; + } + + r->allowed = conf->allowed; + + if (conf->allowed & (AP_METHOD_BIT << method)) { + return DECLINED; + } - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01623) + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01623) "client method denied by server configuration: '%s' to %s%s", r->method, r->filename ? "" : "uri ", r->filename ? r->filename : r->uri); - return HTTP_METHOD_NOT_ALLOWED; + return HTTP_METHOD_NOT_ALLOWED; } -static void *am_create_conf(apr_pool_t * p, char *dummy) +static void *am_create_conf(apr_pool_t *p, char *dummy) { - am_conf_t *conf = apr_pcalloc(p, sizeof(am_conf_t)); + am_conf_t *conf = apr_pcalloc(p, sizeof(am_conf_t)); - conf->allowed = 0; - conf->allowed_set = 0; - return conf; + conf->allowed = 0; + conf->allowed_set = 0; + return conf; } -static void* am_merge_conf(apr_pool_t* pool, void* a, void* b) { - am_conf_t* base = (am_conf_t*) a; - am_conf_t* add = (am_conf_t*) b; - am_conf_t* conf = apr_palloc(pool, sizeof(am_conf_t)); - - if (add->allowed_set) { - conf->allowed = add->allowed; - conf->allowed_set = add->allowed_set; - } else { - conf->allowed = base->allowed; - conf->allowed_set = base->allowed_set; - } +static void* am_merge_conf(apr_pool_t *pool, void *a, void *b) { + am_conf_t *base = (am_conf_t*) a; + am_conf_t *add = (am_conf_t*) b; + am_conf_t *conf = apr_palloc(pool, sizeof(am_conf_t)); + + if (add->allowed_set) { + conf->allowed = add->allowed; + conf->allowed_set = add->allowed_set; + } + else { + conf->allowed = base->allowed; + conf->allowed_set = base->allowed_set; + } - return conf; + return conf; } -static const char *am_allowmethods(cmd_parms *cmd, void *d, int argc, char *const argv[]) +static const char *am_allowmethods(cmd_parms *cmd, void *d, int argc, + char *const argv[]) { - int i; - am_conf_t* conf = (am_conf_t*) d; - if (argc == 0) { - return "AllowMethods: No method or 'reset' keyword given"; - } - if (argc == 1) { - if (strcasecmp("reset", argv[0]) == 0) { - conf->allowed = 0; - conf->allowed_set = 1; - return NULL; - } - } - - for (i = 0; i < argc; i++) { - int m = 0; - m = ap_method_number_of(argv[i]); - if (m == M_INVALID) { - return apr_pstrcat(cmd->pool, "AllowMethods: Invalid Method '", argv[i], "'", NULL); - } - - conf->allowed |= (AP_METHOD_BIT << m); - } - conf->allowed_set = 1; - return NULL; + int i; + am_conf_t *conf = (am_conf_t*) d; + + if (argc == 0) { + return "AllowMethods: No method or 'reset' keyword given"; + } + if (argc == 1) { + if (strcasecmp("reset", argv[0]) == 0) { + conf->allowed = 0; + conf->allowed_set = 1; + return NULL; + } + } + + for (i = 0; i < argc; i++) { + int m; + + m = ap_method_number_of(argv[i]); + if (m == M_INVALID) { + return apr_pstrcat(cmd->pool, "AllowMethods: Invalid Method '", + argv[i], "'", NULL); + } + + conf->allowed |= (AP_METHOD_BIT << m); + } + conf->allowed_set = 1; + return NULL; } static void am_register_hooks(apr_pool_t * p) { - ap_hook_access_checker(am_check_access, NULL, NULL, APR_HOOK_REALLY_FIRST); + ap_hook_access_checker(am_check_access, NULL, NULL, APR_HOOK_REALLY_FIRST); } static const command_rec am_cmds[] = { - AP_INIT_TAKE_ARGV("AllowMethods", am_allowmethods, NULL, - ACCESS_CONF, - "only allow specific methods"), - {NULL} + AP_INIT_TAKE_ARGV("AllowMethods", am_allowmethods, NULL, + ACCESS_CONF, + "only allow specific methods"), + {NULL} }; AP_DECLARE_MODULE(allowmethods) = { - STANDARD20_MODULE_STUFF, - am_create_conf, - am_merge_conf, - NULL, - NULL, - am_cmds, - am_register_hooks, + STANDARD20_MODULE_STUFF, + am_create_conf, + am_merge_conf, + NULL, + NULL, + am_cmds, + am_register_hooks, }; -