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 DF7F060F2 for ; Mon, 13 Jun 2011 11:20:39 +0000 (UTC) Received: (qmail 28476 invoked by uid 500); 13 Jun 2011 11:20:39 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 28431 invoked by uid 500); 13 Jun 2011 11:20:39 -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 28424 invoked by uid 99); 13 Jun 2011 11:20:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2011 11:20:39 +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; Mon, 13 Jun 2011 11:20:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 683CD2388906; Mon, 13 Jun 2011 11:20:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1135089 - /httpd/httpd/trunk/modules/mappers/mod_imagemap.c Date: Mon, 13 Jun 2011 11:20:18 -0000 To: cvs@httpd.apache.org From: sf@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110613112018.683CD2388906@eris.apache.org> Author: sf Date: Mon Jun 13 11:20:18 2011 New Revision: 1135089 URL: http://svn.apache.org/viewvc?rev=1135089&view=rev Log: Code cleanup: 1) use apr_palloc instead of apr_pcalloc when all the fields of the allocated structure are set afterwards. 2) avoid useless calls to 'strcasecmp' when we have already found what we are looking for. Submitted by: Christophe JAILLET PR: 51329 Modified: httpd/httpd/trunk/modules/mappers/mod_imagemap.c Modified: httpd/httpd/trunk/modules/mappers/mod_imagemap.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_imagemap.c?rev=1135089&r1=1135088&r2=1135089&view=diff ============================================================================== --- httpd/httpd/trunk/modules/mappers/mod_imagemap.c (original) +++ httpd/httpd/trunk/modules/mappers/mod_imagemap.c Mon Jun 13 11:20:18 2011 @@ -101,7 +101,7 @@ static void *create_imap_dir_config(apr_ static void *merge_imap_dir_configs(apr_pool_t *p, void *basev, void *addv) { - imap_conf_rec *new = (imap_conf_rec *) apr_pcalloc(p, sizeof(imap_conf_rec)); + imap_conf_rec *new = (imap_conf_rec *) apr_palloc(p, sizeof(imap_conf_rec)); imap_conf_rec *base = (imap_conf_rec *) basev; imap_conf_rec *add = (imap_conf_rec *) addv; @@ -495,10 +495,10 @@ static void menu_blank(request_rec *r, c if (!strcasecmp(menu, "formatted")) { ap_rputs("\n", r); } - if (!strcasecmp(menu, "semiformatted")) { + else if (!strcasecmp(menu, "semiformatted")) { ap_rputs("
\n", r); } - if (!strcasecmp(menu, "unformatted")) { + else if (!strcasecmp(menu, "unformatted")) { ap_rputs("\n", r); } return; @@ -509,10 +509,10 @@ static void menu_comment(request_rec *r, if (!strcasecmp(menu, "formatted")) { ap_rputs("\n", r); /* print just a newline if 'formatted' */ } - if (!strcasecmp(menu, "semiformatted") && *comment) { + else if (!strcasecmp(menu, "semiformatted") && *comment) { ap_rvputs(r, comment, "\n", NULL); } - if (!strcasecmp(menu, "unformatted") && *comment) { + else if (!strcasecmp(menu, "unformatted") && *comment) { ap_rvputs(r, comment, "\n", NULL); } return; /* comments are ignored in the @@ -529,11 +529,11 @@ static void menu_default(request_rec *r, ap_rvputs(r, "
(Default) ", text,
                "
\n", NULL); } - if (!strcasecmp(menu, "semiformatted")) { + else if (!strcasecmp(menu, "semiformatted")) { ap_rvputs(r, "
(Default) ", text,
                "
\n", NULL); } - if (!strcasecmp(menu, "unformatted")) { + else if (!strcasecmp(menu, "unformatted")) { ap_rvputs(r, "", text, "", NULL); } return; @@ -549,11 +549,11 @@ static void menu_directive(request_rec * ap_rvputs(r, "
          ", text,
                "
\n", NULL); } - if (!strcasecmp(menu, "semiformatted")) { + else if (!strcasecmp(menu, "semiformatted")) { ap_rvputs(r, "
          ", text,
                "
\n", NULL); } - if (!strcasecmp(menu, "unformatted")) { + else if (!strcasecmp(menu, "unformatted")) { ap_rvputs(r, "", text, "", NULL); } return;