]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
PR:
authorDoug MacEachern <dougm@apache.org>
Thu, 23 May 2002 03:25:20 +0000 (03:25 +0000)
committerDoug MacEachern <dougm@apache.org>
Thu, 23 May 2002 03:25:20 +0000 (03:25 +0000)
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

src/main/util.c

index b29148657a241d2146ec83f73425baa5c0514ed5..4fe57f3566e7518382c1c8fe8b043365444da2fa 100644 (file)
@@ -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.