]> granicus.if.org Git - apache/commitdiff
Merge r1719018, r1719189, r1719190 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 19 Jan 2016 12:56:11 +0000 (12:56 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 19 Jan 2016 12:56:11 +0000 (12:56 +0000)
Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable in order to save a few cycles.

Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable in order to save a few cycles.

Fix some minor style issue.
Submitted by: jailletc36
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1725506 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/config.c
server/util_regex.c

diff --git a/STATUS b/STATUS
index 557edd08e201bd18a0ac4ff5e318c241b81d046f..72b99390cd8c8f5ecd088d81f61a5d6921852e44 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -112,15 +112,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable in order
-     to save a few cycles.
-     Fix some style issues.
-     trunk patch: http://svn.apache.org/r1719018
-                  http://svn.apache.org/r1719189
-                  http://svn.apache.org/r1719190
-     2.4.x patch: trunk works
-     +1: jailletc36, covener, jim
-
   *) mod_negotiation: Use 'ap_array_str_contains' to simplify code.
      core: likewise
      http: likewise
index cc6070a235991de03d0f78205839f6766496e372..bca8b53cfd52d62d0cc0dffcb20ffc90f187d829 100644 (file)
@@ -136,7 +136,8 @@ AP_DECLARE(int) ap_hook_post_config(ap_HOOK_post_config_t *pf,
         apr_hook_debug_show("post_config", aszPre, aszSucc);
 }
 
-AP_DECLARE(apr_array_header_t *) ap_hook_get_post_config(void) {
+AP_DECLARE(apr_array_header_t *) ap_hook_get_post_config(void)
+{
     return _hooks.link_post_config;
 }
 
@@ -148,7 +149,7 @@ AP_DECLARE(int) ap_run_post_config(apr_pool_t *pconf,
     ap_LINK_post_config_t *pHook;
     int n;
 
-    if(!_hooks.link_post_config)
+    if (!_hooks.link_post_config)
         return;
 
     pHook = (ap_LINK_post_config_t *)_hooks.link_post_config->elts;
@@ -847,7 +848,7 @@ static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms,
     char *w, *w2, *w3;
     const char *errmsg = NULL;
 
-    /** Have we been provided a list of acceptable directives? */
+    /* Have we been provided a list of acceptable directives? */
     if (parms->override_list != NULL) { 
          if (apr_table_get(parms->override_list, cmd->name) != NULL) { 
               override_list_ok = 1;
@@ -1379,7 +1380,7 @@ AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
          */
         last_ptr = &(current->last);
 
-        if(last_ptr && *last_ptr) {
+        if (last_ptr && *last_ptr) {
             current = *last_ptr;
         }
 
@@ -1387,7 +1388,7 @@ AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
             current = current->next;
         }
 
-        if(last_ptr) {
+        if (last_ptr) {
             /* update cached pointer to last node */
             *last_ptr = current;
         }
@@ -1609,8 +1610,8 @@ AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive)
 
     ap_varbuf_init(cmd->temp_pool, &vb, VARBUF_INIT_LEN);
 
-    while((rc = ap_varbuf_cfg_getline(&vb, cmd->config_file, max_len))
-          == APR_SUCCESS) {
+    while ((rc = ap_varbuf_cfg_getline(&vb, cmd->config_file, max_len))
+           == APR_SUCCESS) {
         args = vb.buf;
 
         cmd_name = ap_getword_conf(cmd->temp_pool, &args);
@@ -1912,7 +1913,7 @@ static const char *process_resource_config_fnmatch(server_rec *s,
     /* find the first part of the filename */
     rest = ap_strchr_c(fname, '/');
     if (rest) {
-        fname = apr_pstrndup(ptemp, fname, rest - fname);
+        fname = apr_pstrmemdup(ptemp, fname, rest - fname);
         rest++;
     }
 
index 81eac5308d28c8095209bdda1f6cb38ff972cd4b..2a30d68176961369c7db2b2fd8f3cbab1f8c81d1 100644 (file)
@@ -46,6 +46,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
     ap_rxplus_t *ret = apr_pcalloc(pool, sizeof(ap_rxplus_t));
     char delim = 0;
     enum { SUBSTITUTE = 's', MATCH = 'm'} action = MATCH;
+
     if (!apr_isalnum(pattern[0])) {
         delim = *str++;
     }
@@ -65,7 +66,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
     if (delim) {
         endp = ap_strchr_c(str, delim);
     }
-    if (!endp) { /* there's no delim  or flags */
+    if (!endp) { /* there's no delim or flags */
         if (ap_regcomp(&ret->rx, pattern, 0) == 0) {
             apr_pool_cleanup_register(pool, &ret->rx, rxplus_cleanup,
                                       apr_pool_cleanup_null);
@@ -77,7 +78,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
     }
 
     /* We have a delimiter.  Use it to extract the regexp */
-    rxstr = apr_pstrndup(pool, str, endp-str);
+    rxstr = apr_pstrmemdup(pool, str, endp-str);
 
     /* If it's a substitution, we need the replacement string
      * TODO: possible future enhancement - support other parsing
@@ -89,7 +90,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
             /* missing replacement string is an error */
             return NULL;
         }
-        ret->subs = apr_pstrndup(pool, str, (endp-str));
+        ret->subs = apr_pstrmemdup(pool, str, endp-str);
     }
 
     /* anything after the current delimiter is flags */