From: Christophe Jaillet Date: Sun, 14 Oct 2012 06:54:36 +0000 (+0000) Subject: No need to test for NULL before calling apr_pstrdup. X-Git-Tag: 2.5.0-alpha~6200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=940259c95de16d02407d0cc6177937e0adba0323;p=apache No need to test for NULL before calling apr_pstrdup. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1398025 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 40ff56a4bf..bfcd8114f6 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -207,7 +207,7 @@ static void push_item(apr_array_header_t *arr, char *type, const char *to, } p->type = type; - p->data = data ? apr_pstrdup(arr->pool, data) : NULL; + p->data = apr_pstrdup(arr->pool, data); p->apply_path = apr_pstrcat(arr->pool, path, "*", NULL); if ((type == BY_PATH) && (!ap_is_matchexp(to))) { diff --git a/modules/lua/lua_vmprep.c b/modules/lua/lua_vmprep.c index 91c7d9c757..b22473d867 100644 --- a/modules/lua/lua_vmprep.c +++ b/modules/lua/lua_vmprep.c @@ -356,10 +356,10 @@ static ap_lua_vm_spec* copy_vm_spec(apr_pool_t* pool, ap_lua_vm_spec* spec) { ap_lua_vm_spec* copied_spec = apr_pcalloc(pool, sizeof(ap_lua_vm_spec)); copied_spec->bytecode_len = spec->bytecode_len; - copied_spec->bytecode = spec->bytecode ? apr_pstrdup(pool, spec->bytecode) : 0; + copied_spec->bytecode = apr_pstrdup(pool, spec->bytecode); copied_spec->cb = spec->cb; copied_spec->cb_arg = NULL; - copied_spec->file = spec->file ? apr_pstrdup(pool, spec->file) : 0; + copied_spec->file = apr_pstrdup(pool, spec->file); copied_spec->package_cpaths = apr_array_copy(pool, spec->package_cpaths); copied_spec->package_paths = apr_array_copy(pool, spec->package_paths); copied_spec->pool = pool; diff --git a/modules/ssl/ssl_engine_vars.c b/modules/ssl/ssl_engine_vars.c index 8af1c2610a..536e6b1f73 100644 --- a/modules/ssl/ssl_engine_vars.c +++ b/modules/ssl/ssl_engine_vars.c @@ -508,7 +508,7 @@ static char *ssl_var_lookup_ssl_cert(apr_pool_t *p, request_rec *r, X509 *xs, result = ssl_var_lookup_ssl_cert_PEM(p, xs); } - if (result != NULL && resdup) + if (resdup) result = apr_pstrdup(p, result); return result; } diff --git a/server/error_bucket.c b/server/error_bucket.c index d113c171a8..9c118e6144 100644 --- a/server/error_bucket.c +++ b/server/error_bucket.c @@ -45,7 +45,7 @@ AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error, h = apr_bucket_alloc(sizeof(*h), b->list); h->status = error; - h->data = (buf) ? apr_pstrdup(p, buf) : NULL; + h->data = apr_pstrdup(p, buf); b = apr_bucket_shared_make(b, h, 0, 0); b->type = &ap_bucket_type_error;