From: Doug MacEachern Date: Thu, 23 May 2002 03:25:20 +0000 (+0000) Subject: PR: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6d6b0db7ed404e5feffe4fc88ee4ff19f2e1a5c;p=thirdparty%2Fapache%2Fhttpd.git PR: Obtained from: Submitted by: Reviewed by: ap_escape_logitem referenced c2x() before it was declared, fatal error with hpux cc. move c2x definition before ap_escape_logitem. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@95227 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/main/util.c b/src/main/util.c index b29148657a2..4fe57f3566e 100644 --- a/src/main/util.c +++ b/src/main/util.c @@ -1446,6 +1446,28 @@ API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok) return (strncasecmp(&line[lidx], tok, tlen) == 0); } +/* c2x takes an unsigned, and expects the caller has guaranteed that + * 0 <= what < 256... which usually means that you have to cast to + * unsigned char first, because (unsigned)(char)(x) first goes through + * signed extension to an int before the unsigned cast. + * + * The reason for this assumption is to assist gcc code generation -- + * the unsigned char -> unsigned extension is already done earlier in + * both uses of this code, so there's no need to waste time doing it + * again. + */ +static const char c2x_table[] = "0123456789abcdef"; + +static ap_inline unsigned char *c2x(unsigned what, unsigned char *where) +{ +#ifdef CHARSET_EBCDIC + what = os_toascii[what]; +#endif /*CHARSET_EBCDIC*/ + *where++ = '%'; + *where++ = c2x_table[what >> 4]; + *where++ = c2x_table[what & 0xf]; + return where; +} /* escape a string for logging */ API_EXPORT(char *) ap_escape_logitem(pool *p, const char *str) @@ -1603,29 +1625,6 @@ API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname, } } -/* c2x takes an unsigned, and expects the caller has guaranteed that - * 0 <= what < 256... which usually means that you have to cast to - * unsigned char first, because (unsigned)(char)(x) first goes through - * signed extension to an int before the unsigned cast. - * - * The reason for this assumption is to assist gcc code generation -- - * the unsigned char -> unsigned extension is already done earlier in - * both uses of this code, so there's no need to waste time doing it - * again. - */ -static const char c2x_table[] = "0123456789abcdef"; - -static ap_inline unsigned char *c2x(unsigned what, unsigned char *where) -{ -#ifdef CHARSET_EBCDIC - what = os_toascii[what]; -#endif /*CHARSET_EBCDIC*/ - *where++ = '%'; - *where++ = c2x_table[what >> 4]; - *where++ = c2x_table[what & 0xf]; - return where; -} - /* * escape_path_segment() escapes a path segment, as defined in RFC 1808. This * routine is (should be) OS independent.