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
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
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;
}
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;
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;
*/
last_ptr = &(current->last);
- if(last_ptr && *last_ptr) {
+ if (last_ptr && *last_ptr) {
current = *last_ptr;
}
current = current->next;
}
- if(last_ptr) {
+ if (last_ptr) {
/* update cached pointer to last node */
*last_ptr = current;
}
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);
/* 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++;
}
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++;
}
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);
}
/* 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
/* 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 */