~ chicken-core (chicken-5) c3dfc51e1e3c83a6f70fa9682a6d3e7833d9da79
commit c3dfc51e1e3c83a6f70fa9682a6d3e7833d9da79
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Sat Dec 5 14:43:01 2015 +0100
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Mon Dec 7 21:46:33 2015 +1300
Fix "slashify" C string escaping mechanism.
If you have backslashes in procedure names, they would incorrectly be
converted to slashes in the call trace. The "slashify" procedure is
only used in one place, and only for injecting strings to C, which means
it's easy to fix.
Signed-off-by: Evan Hanson <evhan@foldling.org>
diff --git a/c-backend.scm b/c-backend.scm
index 73747835..fffae6c6 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -236,7 +236,7 @@
(fn (car subs)) )
(when name
(if emit-trace-info
- (gen #t "C_trace(\"" (slashify name-str) "\");")
+ (gen #t "C_trace(\"" (backslashify name-str) "\");")
(gen #t "/* " (uncommentify name-str) " */") ) )
(cond ((eq? '##core#proc (node-class fn))
(gen #\{)
diff --git a/compiler-namespace.scm b/compiler-namespace.scm
index dea9e4b0..1bbbcdf1 100644
--- a/compiler-namespace.scm
+++ b/compiler-namespace.scm
@@ -265,7 +265,7 @@
simplified-ops
simplify-named-call
simplify-type
- slashify
+ backslashify
sort-symbols
source-filename
source-info->string
diff --git a/support.scm b/support.scm
index df306814..1c487827 100644
--- a/support.scm
+++ b/support.scm
@@ -168,7 +168,7 @@
((string? x) (string->symbol x))
(else (string->symbol (sprintf "~a" x))) ) )
-(define (slashify s) (string-translate (->string s) "\\" "/"))
+(define (backslashify s) (string-translate (->string s) "\\" "\\\\"))
(define (uncommentify s) (string-translate* (->string s) '(("*/" . "*_/"))))
Trap