You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2005/10/24 03:08:28 UTC
svn commit: r327898 - /httpd/httpd/branches/2.2.x/server/util.c
Author: colm
Date: Sun Oct 23 18:08:25 2005
New Revision: 327898
URL: http://svn.apache.org/viewcvs?rev=327898&view=rev
Log:
Merge r292111 from trunk:
Clean up c2x code-path by not double-setting the prefix variable.
* server/util.c
(c2x): Take a new prefix parameter instead of hard-coding '%' and then
conditionally setting 'x' for half of the cases.
Submitted by: jerenkrantz
Reviewed by: nd, colm
Modified:
httpd/httpd/branches/2.2.x/server/util.c
Modified: httpd/httpd/branches/2.2.x/server/util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/server/util.c?rev=327898&r1=327897&r2=327898&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/util.c (original)
+++ httpd/httpd/branches/2.2.x/server/util.c Sun Oct 23 18:08:25 2005
@@ -1659,12 +1659,13 @@
*/
static const char c2x_table[] = "0123456789abcdef";
-static APR_INLINE unsigned char *c2x(unsigned what, unsigned char *where)
+static APR_INLINE unsigned char *c2x(unsigned what, unsigned char prefix,
+ unsigned char *where)
{
#if APR_CHARSET_EBCDIC
what = apr_xlate_conv_byte(ap_hdrs_to_ascii, (unsigned char)what);
#endif /*APR_CHARSET_EBCDIC*/
- *where++ = '%';
+ *where++ = prefix;
*where++ = c2x_table[what >> 4];
*where++ = c2x_table[what & 0xf];
return where;
@@ -1694,7 +1695,7 @@
while ((c = *s)) {
if (TEST_CHAR(c, T_ESCAPE_PATH_SEGMENT)) {
- d = c2x(c, d);
+ d = c2x(c, '%', d);
}
else {
*d++ = c;
@@ -1723,7 +1724,7 @@
}
while ((c = *s)) {
if (TEST_CHAR(c, T_OS_ESCAPE_PATH)) {
- d = c2x(c, d);
+ d = c2x(c, '%', d);
}
else {
*d++ = c;
@@ -1810,8 +1811,7 @@
*d++ = *s;
break;
default:
- c2x(*s, d);
- *d = 'x';
+ c2x(*s, 'x', d);
d += 3;
}
}
@@ -1874,8 +1874,7 @@
ep = --d; /* break the for loop as well */
break;
}
- c2x(*s, d);
- *d = 'x';
+ c2x(*s, 'x', d);
d += 3;
}
}