From bec4b540666bed3d751c9486b95d2425d5e82ce9 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Mon, 11 Mar 2013 16:33:42 +0000 Subject: [PATCH] Merge r1429564 from trunk: Use ap_bin2hex instead of sprintf(..., "%02x". It gives the same output and is faster. No real speedup should be achieved on production machine, because this is done only for characters that need to be escaped. However, this will close PR 50919. Submitted by: jailletc36 Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1455222 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 5 ----- modules/loggers/mod_log_forensic.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/STATUS b/STATUS index a004c46941..a448bc608e 100644 --- a/STATUS +++ b/STATUS @@ -117,11 +117,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: 2.4.x cumulative patch: http://people.apache.org/~jailletc36/backport5.patch (minus CHANGES for 1448171) +1: jailletc36, igalic, jim - * mod_log_forensic: Speed up logging of characters that need to be escaped. PR 50919 - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1429564 - 2.4.x patch: trunk patch applies. - +1: jailletc36, humbedooh, jim - * ssl_util_ssl: Speed up logging function by x4 using ap_bin2hex intoduced in 2.4.4 It will be in lowercase instead of uppercase, but it is only for logging. I don't think this is a real issue. trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1429559 diff --git a/modules/loggers/mod_log_forensic.c b/modules/loggers/mod_log_forensic.c index 1be123024b..bb808e8888 100644 --- a/modules/loggers/mod_log_forensic.c +++ b/modules/loggers/mod_log_forensic.c @@ -126,7 +126,7 @@ static char *log_escape(char *q, const char *e, const char *p) if (test_char_table[*(unsigned char *)p]&T_ESCAPE_FORENSIC) { ap_assert(q+2 < e); *q++ = '%'; - sprintf(q, "%02x", *(unsigned char *)p); + ap_bin2hex(p, 1, q); q += 2; } else