]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Provide TEST_CHAR marco in test_char.h
authorYann Ylavic <ylavic@apache.org>
Thu, 28 Mar 2019 16:24:30 +0000 (16:24 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 28 Mar 2019 16:24:30 +0000 (16:24 +0000)
For (internal) usage outside server/util.c, mod_log_forensic for now
and mod_cache (T_HTTP_TOKEN_STOP) in a few...

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1856490 13f79535-47bb-0310-9956-ffa450edef68

modules/loggers/mod_log_forensic.c
server/gen_test_char.c
server/util.c

index 359cd63935e4f465aee0cea7bcd8653fd4960193..f4ef129a570ddd533c60df43b65e9f31bf5c273e 100644 (file)
@@ -123,7 +123,7 @@ static char *log_escape(char *q, const char *e, const char *p)
 {
     for ( ; *p ; ++p) {
         ap_assert(q < e);
-        if (test_char_table[*(unsigned char *)p]&T_ESCAPE_FORENSIC) {
+        if (TEST_CHAR(*p, T_ESCAPE_FORENSIC)) {
             ap_assert(q+2 < e);
             *q++ = '%';
             ap_bin2hex(p, 1, q);
index 48ae6f47d02dfc46f4ace8c01eee2c0bf0520312..cd20577e6aaa009598779e85314e33c10021ed28 100644 (file)
@@ -167,7 +167,16 @@ int main(int argc, char *argv[])
         printf("0x%03x%c", flags, (c < 255) ? ',' : ' ');
     }
 
-    printf("\n};\n");
+    printf("\n};\n\n");
+
+    printf(
+      "/* we assume the folks using this ensure 0 <= c < 256... which means\n"
+      " * you need a cast to (unsigned char) first, you can't just plug a\n"
+      " * char in here and get it to work, because if char is signed then it\n"
+      " * will first be sign extended.\n"
+      " */\n"
+      "#define TEST_CHAR(c, f) (test_char_table[(unsigned char)(c)] & (f))\n"
+    );
 
     return 0;
 }
index a4e42656678eb8cb3cfb1632dccc77c73959022a..3e1b536de7e3be3b25b02ae0c00ed20dfb1725cb 100644 (file)
  */
 #include "test_char.h"
 
-/* we assume the folks using this ensure 0 <= c < 256... which means
- * you need a cast to (unsigned char) first, you can't just plug a
- * char in here and get it to work, because if char is signed then it
- * will first be sign extended.
- */
-#define TEST_CHAR(c, f)        (test_char_table[(unsigned char)(c)] & (f))
-
 /* Win32/NetWare/OS2 need to check for both forward and back slashes
  * in ap_getparents() and ap_escape_url.
  */