httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1135089 - /httpd/httpd/trunk/modules/mappers/mod_imagemap.c
Date Mon, 13 Jun 2011 11:20:18 GMT
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 <christophe jaillet wanadoo fr>
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("<br />\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, "<pre>(Default) <a href=\"", href, "\">", text,
                "</a></pre>\n", NULL);
     }
-    if (!strcasecmp(menu, "semiformatted")) {
+    else if (!strcasecmp(menu, "semiformatted")) {
         ap_rvputs(r, "<pre>(Default) <a href=\"", href, "\">", text,
                "</a></pre>\n", NULL);
     }
-    if (!strcasecmp(menu, "unformatted")) {
+    else if (!strcasecmp(menu, "unformatted")) {
         ap_rvputs(r, "<a href=\"", href, "\">", text, "</a>", NULL);
     }
     return;
@@ -549,11 +549,11 @@ static void menu_directive(request_rec *
         ap_rvputs(r, "<pre>          <a href=\"", href, "\">", text,
                "</a></pre>\n", NULL);
     }
-    if (!strcasecmp(menu, "semiformatted")) {
+    else if (!strcasecmp(menu, "semiformatted")) {
         ap_rvputs(r, "<pre>          <a href=\"", href, "\">", text,
                "</a></pre>\n", NULL);
     }
-    if (!strcasecmp(menu, "unformatted")) {
+    else if (!strcasecmp(menu, "unformatted")) {
         ap_rvputs(r, "<a href=\"", href, "\">", text, "</a>", NULL);
     }
     return;



Mime
View raw message