From: Stefan Fritsch Date: Mon, 13 Jun 2011 11:20:18 +0000 (+0000) Subject: Code cleanup: X-Git-Tag: 2.3.13~56 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04d48349bbbbeb10e523058d855e9cb8607a9a34;p=apache 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1135089 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_imagemap.c b/modules/mappers/mod_imagemap.c index 6ea44d0870..5fc47970c4 100644 --- a/modules/mappers/mod_imagemap.c +++ b/modules/mappers/mod_imagemap.c @@ -101,7 +101,7 @@ static void *create_imap_dir_config(apr_pool_t *p, char *dummy) 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, char *menu) 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, char *menu, char *comment) 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, char *menu, char *href, char *text) 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 *r, char *menu, char *href, char *text) 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;