[or-cvs] [tor/master] Save a couple characters' allocation in esc_for_log

nickm at torproject.org nickm at torproject.org
Mon Jun 14 18:03:54 UTC 2010


Author: Florian Zumbiehl <florz at florz.de>
Date: Mon, 14 Jun 2010 14:05:03 -0400
Subject: Save a couple characters' allocation in esc_for_log
Commit: 426116113faa9648ac4a000731268c64bfce16cb

---
 changes/less_alloc_for_esc |    3 +++
 src/common/util.c          |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
 create mode 100644 changes/less_alloc_for_esc

diff --git a/changes/less_alloc_for_esc b/changes/less_alloc_for_esc
new file mode 100644
index 0000000..b10953a
--- /dev/null
+++ b/changes/less_alloc_for_esc
@@ -0,0 +1,3 @@
+ o Minor bugfixes
+   - Save a couple bytes in memory allocation every time we escape
+     certain characters in a string.  Patch from Florian Zumbiehl.
diff --git a/src/common/util.c b/src/common/util.c
index f5001ab..8531d12 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -940,6 +940,9 @@ esc_for_log(const char *s)
       case '\\':
       case '\"':
       case '\'':
+      case '\r':
+      case '\n':
+      case '\t':
         len += 2;
         break;
       default:
-- 
1.6.5



More information about the tor-commits mailing list