~ chicken-core (chicken-5) 451b6577c2077a8956b55b618e74d7ac82fa978d
commit 451b6577c2077a8956b55b618e74d7ac82fa978d Author: Peter Bex <peter@more-magic.net> AuthorDate: Sat Dec 5 14:52:02 2015 +0100 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Mon Dec 7 21:54:32 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 b1dff0c1..025e74b4 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -65,8 +65,7 @@ (intersperse lst #\space) ) ) ;; Hacky procedures to make certain names more suitable for use in C. -;; TODO: Slashify should probably be changed to convert \ into \\? -(define (slashify s) (string-translate (->string s) "\\" "/")) +(define (backslashify s) (string-translate (->string s) "\\" "\\\\")) (define (uncommentify s) (string-translate* (->string s) '(("*/" . "*_/")))) ;;; Generate target code: @@ -248,7 +247,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 #\{)Trap