You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/03/10 03:49:53 UTC
svn commit: r156727 - in httpd/apreq/branches/multi-env-unstable/library:
param.c util.c
Author: joes
Date: Wed Mar 9 18:49:50 2005
New Revision: 156727
URL: http://svn.apache.org/viewcvs?view=rev&rev=156727
Log:
A few code optimizations.
Submitted by: Max Kellermann
Reviewed by: joes
Modified:
httpd/apreq/branches/multi-env-unstable/library/param.c
httpd/apreq/branches/multi-env-unstable/library/util.c
Modified: httpd/apreq/branches/multi-env-unstable/library/param.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/param.c?view=diff&r1=156726&r2=156727
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/param.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/param.c Wed Mar 9 18:49:50 2005
@@ -102,7 +102,7 @@
*(const apreq_value_t **)&v = &p->v;
if (vlen > 0) {
- status = apreq_decode(v->data, &vlen, word + nlen + 1, vlen);
+ status = apreq_decode(v->data, &v->dlen, word + nlen + 1, vlen);
if (status != APR_SUCCESS) {
*param = NULL;
return status;
@@ -113,13 +113,12 @@
}
v->name = v->data + vlen + 1;
- status = apreq_decode(v->name, &nlen, word, nlen);
+ status = apreq_decode(v->name, &v->nlen, word, nlen);
if (status != APR_SUCCESS) {
*param = NULL;
return status;
}
- v->nlen = nlen;
- v->dlen = vlen;
+
*param = p;
return APR_SUCCESS;
Modified: httpd/apreq/branches/multi-env-unstable/library/util.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/util.c?view=diff&r1=156726&r2=156727
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/util.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/util.c Wed Mar 9 18:49:50 2005
@@ -39,9 +39,12 @@
while (apr_isspace(*p))
++p;
- switch (apr_tolower(*p)) {
+ switch (*p) {
+ case 'G': /* fall thru */
case 'g': return n * 1024*1024*1024;
+ case 'M': /* fall thru */
case 'm': return n * 1024*1024;
+ case 'K': /* fall thru */
case 'k': return n * 1024;
}
@@ -428,9 +431,6 @@
rv = apr_palloc(p, len);
- if (n == 0)
- return rv;
-
/* Pass two --- copy the argument strings into the result space */
d = rv;
@@ -510,7 +510,7 @@
if (s != APR_SUCCESS)
return s;
- while (--n >= 0)
+ while (--n >= 0 && bytes_avail <= len)
bytes_avail += v[n].iov_len;
@@ -525,11 +525,8 @@
v[n].iov_base = (char *)(v[n].iov_base) + len;
if (n > 0) {
- struct iovec *dest = v;
- do {
- *dest++ = v[n++];
- } while (n < *nelts);
- *nelts = dest - v;
+ (*nelts) -= n;
+ memmove(v, v + n, sizeof(*v) * *nelts);
}
else {
s = apreq_fwritev(f, v, nelts, &len);