From: Graham Leggett Date: Thu, 26 Dec 2013 18:08:28 +0000 (+0000) Subject: * easy proposals to synch 2.4.x and trunk X-Git-Tag: 2.4.8~332 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5eca70cf6fd0b0521d81fd2723ac825172642378;p=apache * easy proposals to synch 2.4.x and trunk - log.c: avoid needless apr_pstrdup() - Use apr_pstrmemdup instead of apr_pstrndup when this is safe. - Use apr_pstrmemdup instead of apr_pstrndup when this is safe. - Remove redundant check - 'ap_getword_conf' does not return NULL but an empty string - Ease logic around 'ap_getword_conf' and drop useless line of code. - 'ap_getword_conf' can not return NULL - 'ap_getword_conf' can not return NULL - Remove redundant check (already performed the line before) - Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable trunk patches: - https://svn.apache.org/viewvc?view=revision&revision=1532122 - https://svn.apache.org/viewvc?view=revision&revision=1549676 - https://svn.apache.org/viewvc?view=revision&revision=1549680 - https://svn.apache.org/viewvc?view=revision&revision=1550651 - https://svn.apache.org/viewvc?view=revision&revision=1551005 - https://svn.apache.org/viewvc?view=revision&revision=1551009 - https://svn.apache.org/viewvc?view=revision&revision=1551010 - https://svn.apache.org/viewvc?view=revision&revision=1551011 - https://svn.apache.org/viewvc?view=revision&revision=1551012 - https://svn.apache.org/viewvc?view=revision&revision=1551013 2.4.x patches: trunk patches work http://people.apache.org/~jim/patches/ez-2.4-v2.patch +1: jailletc36, jim, minfrin git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1553532 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index d9c4c3bdd4..872a4f6633 100644 --- a/STATUS +++ b/STATUS @@ -98,31 +98,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * easy proposals to synch 2.4.x and trunk - - log.c: avoid needless apr_pstrdup() - - Use apr_pstrmemdup instead of apr_pstrndup when this is safe. - - Use apr_pstrmemdup instead of apr_pstrndup when this is safe. - - Remove redundant check - - 'ap_getword_conf' does not return NULL but an empty string - - Ease logic around 'ap_getword_conf' and drop useless line of code. - - 'ap_getword_conf' can not return NULL - - 'ap_getword_conf' can not return NULL - - Remove redundant check (already performed the line before) - - Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable - trunk patches: - - https://svn.apache.org/viewvc?view=revision&revision=1532122 - - https://svn.apache.org/viewvc?view=revision&revision=1549676 - - https://svn.apache.org/viewvc?view=revision&revision=1549680 - - https://svn.apache.org/viewvc?view=revision&revision=1550651 - - https://svn.apache.org/viewvc?view=revision&revision=1551005 - - https://svn.apache.org/viewvc?view=revision&revision=1551009 - - https://svn.apache.org/viewvc?view=revision&revision=1551010 - - https://svn.apache.org/viewvc?view=revision&revision=1551011 - - https://svn.apache.org/viewvc?view=revision&revision=1551012 - - https://svn.apache.org/viewvc?view=revision&revision=1551013 - 2.4.x patches: trunk patches work - http://people.apache.org/~jim/patches/ez-2.4-v2.patch - +1: jailletc36, jim, minfrin PATCHES PROPOSED TO BACKPORT FROM TRUNK: diff --git a/modules/cache/mod_cache_disk.c b/modules/cache/mod_cache_disk.c index 2b50aef994..95ff1fc029 100644 --- a/modules/cache/mod_cache_disk.c +++ b/modules/cache/mod_cache_disk.c @@ -381,7 +381,7 @@ static int create_entity(cache_handle_t *h, request_rec *r, const char *key, apr dobj->name = obj->key; dobj->prefix = NULL; /* Save the cache root */ - dobj->root = apr_pstrndup(r->pool, conf->cache_root, conf->cache_root_len); + dobj->root = apr_pstrmemdup(r->pool, conf->cache_root, conf->cache_root_len); dobj->root_len = conf->cache_root_len; apr_pool_create(&pool, r->pool); @@ -441,7 +441,7 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key) dobj->prefix = NULL; /* Save the cache root */ - dobj->root = apr_pstrndup(r->pool, conf->cache_root, conf->cache_root_len); + dobj->root = apr_pstrmemdup(r->pool, conf->cache_root, conf->cache_root_len); dobj->root_len = conf->cache_root_len; dobj->vary.file = header_file(r->pool, conf, dobj, key); diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c index 8e4231dc37..b3d666ba22 100644 --- a/modules/cluster/mod_heartmonitor.c +++ b/modules/cluster/mod_heartmonitor.c @@ -292,7 +292,7 @@ static apr_status_t hm_file_update_stat(hm_ctx_t *ctx, hm_server_t *s, apr_pool_ buf[bsize - 1] = 0; t = strchr(buf, ' '); if (t) { - ip = apr_pstrndup(pool, buf, t - buf); + ip = apr_pstrmemdup(pool, buf, t - buf); } else { ip = NULL; } diff --git a/modules/lua/mod_lua.c b/modules/lua/mod_lua.c index 6e3390fbd2..3eda5fc1a2 100644 --- a/modules/lua/mod_lua.c +++ b/modules/lua/mod_lua.c @@ -954,11 +954,11 @@ static const char *register_named_block_function_hook(const char *name, if (line[0]) { const char *word; word = ap_getword_conf(cmd->temp_pool, &line); - if (word && *word) { + if (*word) { function = apr_pstrdup(cmd->pool, word); } word = ap_getword_conf(cmd->temp_pool, &line); - if (word && *word) { + if (*word) { if (!strcasecmp("early", word)) { when = AP_LUA_HOOK_FIRST; } diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index 4364ff9551..9707ad50be 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -66,7 +66,7 @@ static const char *add_index(cmd_parms *cmd, void *dummy, const char *arg) /* peek to see if "disabled" is first in a series of arguments */ const char *tt = t; const char *ww = ap_getword_conf(cmd->temp_pool, &tt); - if (ww == NULL || !ww[0]) { + if (ww[0] == '\0') { /* "disabled" is first, and alone */ apr_array_clear(d->index_names); break; diff --git a/modules/metadata/mod_expires.c b/modules/metadata/mod_expires.c index 2ef3d89953..049cfc2250 100644 --- a/modules/metadata/mod_expires.c +++ b/modules/metadata/mod_expires.c @@ -267,10 +267,7 @@ static char *check_code(apr_pool_t *p, const char *code, char **real_code) /* */ word = ap_getword_conf(p, &code); - if (word[0]) { - /* do nothing */ - } - else { + if (word[0] == '\0') { return apr_pstrcat(p, "bad expires code, missing ", NULL); } diff --git a/modules/metadata/mod_remoteip.c b/modules/metadata/mod_remoteip.c index 74ea80350c..1926066119 100644 --- a/modules/metadata/mod_remoteip.c +++ b/modules/metadata/mod_remoteip.c @@ -198,7 +198,7 @@ static const char *proxylist_read(cmd_parms *cmd, void *cfg, while (!(ap_cfg_getline(lbuf, MAX_STRING_LEN, cfp))) { args = lbuf; while (*(arg = ap_getword_conf(cmd->temp_pool, &args)) != '\0') { - if (*arg == '#' || *arg == '\0') { + if (*arg == '#') { break; } errmsg = proxies_set(cmd, cfg, arg); diff --git a/modules/proxy/balancers/mod_lbmethod_heartbeat.c b/modules/proxy/balancers/mod_lbmethod_heartbeat.c index 77fb994ff1..e9e1034405 100644 --- a/modules/proxy/balancers/mod_lbmethod_heartbeat.c +++ b/modules/proxy/balancers/mod_lbmethod_heartbeat.c @@ -162,7 +162,7 @@ static apr_status_t readfile_heartbeats(const char *path, apr_hash_t *servers, continue; } - ip = apr_pstrndup(pool, buf, t - buf); + ip = apr_pstrmemdup(pool, buf, t - buf); t++; server = apr_hash_get(servers, ip, APR_HASH_KEY_STRING); diff --git a/modules/session/mod_session_crypto.c b/modules/session/mod_session_crypto.c index 984a048762..4d65bb8376 100644 --- a/modules/session/mod_session_crypto.c +++ b/modules/session/mod_session_crypto.c @@ -593,7 +593,7 @@ static const char *set_crypto_passphrase_file(cmd_parms *cmd, void *config, while (!(ap_cfg_getline(buffer, sizeof(buffer), file))) { args = buffer; while (*(arg = ap_getword_conf(cmd->pool, &args)) != '\0') { - if (*arg == '#' || *arg == 0) { + if (*arg == '#') { break; } set_crypto_passphrase(cmd, config, arg); diff --git a/os/unix/unixd.c b/os/unix/unixd.c index a86630f39b..c10ea9d699 100644 --- a/os/unix/unixd.c +++ b/os/unix/unixd.c @@ -74,7 +74,7 @@ AP_DECLARE(void) ap_unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, return; } - if ((str = ap_getword_conf(cmd->pool, &arg))) { + if (*(str = ap_getword_conf(cmd->pool, &arg)) != '\0') { if (!strcasecmp(str, "max")) { cur = limit->rlim_max; } @@ -88,7 +88,7 @@ AP_DECLARE(void) ap_unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, return; } - if (arg2 && (str = ap_getword_conf(cmd->pool, &arg2))) { + if (arg2 && (*(str = ap_getword_conf(cmd->pool, &arg2)) != '\0')) { max = atol(str); } diff --git a/server/log.c b/server/log.c index bcfdcdb6eb..9a15d24dbb 100644 --- a/server/log.c +++ b/server/log.c @@ -331,10 +331,8 @@ static int log_child(apr_pool_t *p, const char *progname, && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn)) == APR_SUCCESS)) { char **args; - const char *pname; apr_tokenize_to_argv(progname, &args, p); - pname = apr_pstrdup(p, args[0]); procnew = (apr_proc_t *)apr_pcalloc(p, sizeof(*procnew)); if (dummy_stderr) { @@ -342,7 +340,7 @@ static int log_child(apr_pool_t *p, const char *progname, rc = apr_procattr_child_err_set(procattr, errfile, NULL); } - rc = apr_proc_create(procnew, pname, (const char * const *)args, + rc = apr_proc_create(procnew, args[0], (const char * const *)args, NULL, procattr, p); if (rc == APR_SUCCESS) { @@ -1566,12 +1564,10 @@ static apr_status_t piped_log_spawn(piped_log *pl) } else { char **args; - const char *pname; apr_tokenize_to_argv(pl->program, &args, pl->p); - pname = apr_pstrdup(pl->p, args[0]); procnew = apr_pcalloc(pl->p, sizeof(apr_proc_t)); - status = apr_proc_create(procnew, pname, (const char * const *) args, + status = apr_proc_create(procnew, args[0], (const char * const *) args, NULL, procattr, pl->p); if (status == APR_SUCCESS) { diff --git a/server/util_ebcdic.c b/server/util_ebcdic.c index 1a8c0ba305..7faae794de 100644 --- a/server/util_ebcdic.c +++ b/server/util_ebcdic.c @@ -102,7 +102,7 @@ int ap_rvputs_proto_in_ascii(request_rec *r, ...) if (s == NULL) break; len = strlen(s); - ascii_s = apr_pstrndup(r->pool, s, len); + ascii_s = apr_pstrmemdup(r->pool, s, len); ap_xlate_proto_to_ascii(ascii_s, len); if (ap_rputs(ascii_s, r) < 0) return -1;