From: Nick Kew Date: Wed, 25 Jul 2007 13:13:49 +0000 (+0000) Subject: Backport trivial cleanups X-Git-Tag: 2.2.5~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5ff6add015a55402ccfab59985acbc0b909cd63;p=thirdparty%2Fapache%2Fhttpd.git Backport trivial cleanups git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@559449 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 064d71f103f..1b70c165d5a 100644 --- a/STATUS +++ b/STATUS @@ -257,36 +257,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK: http://people.apache.org/~jfclere/patches/ProxyIOBufferSize.1.patch +1: jfclere, mturk - * support/htcacheclean.c: Trivial cleanups - PR: 38699 - Christophe JAILLET - http://svn.apache.org/viewvc?view=rev&revision=557837 - +1: niq, trawick, rpluem - - * mod_cache: Trivial cleanups - PR: 42005 - Christophe JAILLET - http://svn.apache.org/viewvc?view=rev&revision=557837 - +1: niq, trawick, rpluem - - * server/request.c: Trivial cleanups - PR: 42006 - Christophe JAILLET - http://svn.apache.org/viewvc?view=rev&revision=557837 - +1: niq, trawicki, rpluem - - * Worker and Event MPMs: Trivial cleanups - PR: 42007 - Christophe JAILLET - http://svn.apache.org/viewvc?view=rev&revision=557837 - +1: niq, trawick, rpluem - - * server/util.c, modules/mappers/mod_rewrite.c: Trivial cleanups - PR: 42009 - Christophe JAILLET - http://svn.apache.org/viewvc?view=rev&revision=557837 - +1: niq, trawick - -1: rpluem says: This creates a bug. Please add - http://svn.apache.org/viewvc?view=rev&rev=558133 - to the proposal and you have my +1. - niq: agrees with rpluem, and points to my post to dev@httpd - from this morning. This trivial cleanup is r557837+r558133. - * multiple files, Trivial cleanups PR: 39518 - Christophe JAILLET http://svn.apache.org/viewvc?view=rev&revision=557837 diff --git a/modules/cache/cache_cache.c b/modules/cache/cache_cache.c index 6db98f71a66..860800bb4c9 100644 --- a/modules/cache/cache_cache.c +++ b/modules/cache/cache_cache.c @@ -85,13 +85,7 @@ CACHE_DECLARE(void) cache_free(cache_cache_t *c) CACHE_DECLARE(void*) cache_find(cache_cache_t* c, const char *key) { - void *e; - - e = cache_hash_get(c->ht, key, CACHE_HASH_KEY_STRING); - if (!e) - return NULL; - - return e; + return cache_hash_get(c->ht, key, CACHE_HASH_KEY_STRING); } CACHE_DECLARE(void) cache_update(cache_cache_t* c, void *entry) diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 6bd5a95f889..39dc11fbb6e 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -1061,11 +1061,7 @@ static char *rewrite_mapfunc_toupper(request_rec *r, char *key) static char *rewrite_mapfunc_tolower(request_rec *r, char *key) { - char *p; - - for (p = key; *p; ++p) { - *p = apr_tolower(*p); - } + ap_str_tolower(key); return key; } diff --git a/server/mpm/experimental/event/fdqueue.c b/server/mpm/experimental/event/fdqueue.c index 51952ced668..c0ef9bbbb1f 100644 --- a/server/mpm/experimental/event/fdqueue.c +++ b/server/mpm/experimental/event/fdqueue.c @@ -65,8 +65,7 @@ apr_status_t ap_queue_info_create(fd_queue_info_t ** queue_info, apr_status_t rv; fd_queue_info_t *qi; - qi = apr_palloc(pool, sizeof(*qi)); - memset(qi, 0, sizeof(*qi)); + qi = apr_pcalloc(pool, sizeof(*qi)); rv = apr_thread_mutex_create(&qi->idlers_mutex, APR_THREAD_MUTEX_DEFAULT, pool); diff --git a/server/mpm/worker/fdqueue.c b/server/mpm/worker/fdqueue.c index 6b5485b3a86..8be7c9fa2da 100644 --- a/server/mpm/worker/fdqueue.c +++ b/server/mpm/worker/fdqueue.c @@ -58,8 +58,7 @@ apr_status_t ap_queue_info_create(fd_queue_info_t **queue_info, apr_status_t rv; fd_queue_info_t *qi; - qi = apr_palloc(pool, sizeof(*qi)); - memset(qi, 0, sizeof(*qi)); + qi = apr_pcalloc(pool, sizeof(*qi)); rv = apr_thread_mutex_create(&qi->idlers_mutex, APR_THREAD_MUTEX_DEFAULT, pool); diff --git a/server/request.c b/server/request.c index 42696246b1c..92e9154711a 100644 --- a/server/request.c +++ b/server/request.c @@ -1742,9 +1742,9 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *dirent, /* ap_make_full_path overallocated the buffers * by one character to help us out here. */ - strcpy(rnew->filename + strlen(rnew->filename), "/"); + strcat(rnew->filename, "/"); if (!rnew->path_info || !*rnew->path_info) { - strcpy(rnew->uri + strlen(rnew->uri ), "/"); + strcat(rnew->uri, "/"); } } diff --git a/server/util.c b/server/util.c index 55ed076b5f5..e1be3d1831d 100644 --- a/server/util.c +++ b/server/util.c @@ -2074,10 +2074,9 @@ AP_DECLARE(void) ap_content_type_tolower(char *str) if (semi) { *semi = '\0'; } - while (*str) { - *str = apr_tolower(*str); - ++str; - } + + ap_str_tolower(str); + if (semi) { *semi = ';'; } diff --git a/support/htcacheclean.c b/support/htcacheclean.c index 5a1649dd305..36a80051f09 100644 --- a/support/htcacheclean.c +++ b/support/htcacheclean.c @@ -473,9 +473,7 @@ static int process_dir(char *path, apr_pool_t *pool) e->dtime = d->dtime; e->hsize = d->hsize; e->dsize = d->dsize; - e->basename = apr_palloc(pool, - strlen(d->basename) + 1); - strcpy(e->basename, d->basename); + e->basename = apr_pstrdup(pool, d->basename); break; } else {