[Git][cmucl/cmucl][master] 2 commits: Fix #34: Handle newline character correctly

Raymond Toy rtoy at common-lisp.net
Thu Dec 8 05:20:53 UTC 2016


Raymond Toy pushed to branch master at cmucl / cmucl


Commits:
d959c164 by Raymond Toy at 2016-12-07T21:19:19-08:00
Fix #34: Handle newline character correctly

The string containing #\Newline that is used to output the newline
character worked on little-endian architectures because the low octet
was first in memory.  However on a big-endian sparc, a NUL character
was output instead since the high octet is first in memory.

So, create a explicit unsigned-byte 8 array containing exactly 1 octet
that represents a newline character code.

Tests pass on both sparc and x86/linux.

- - - - -
3b4745d3 by Raymond Toy at 2016-12-08T05:20:53+00:00
Merge branch 'rtoy-fix-issue-34' into 'master'

Fix #34: Handle newline character correctly

The string containing #\Newline that is used to output the newline
character worked on little-endian architectures because the low octet
was first in memory.  However on a big-endian sparc, a NUL character
was output instead since the high octet is first in memory.

So, create a explicit unsigned-byte 8 array containing exactly 1 octet
that represents a newline character code.

Tests pass on both sparc and x86/linux.

See merge request !19
- - - - -


1 changed file:

- src/code/run-program.lisp


Changes:

=====================================
src/code/run-program.lisp
=====================================
--- a/src/code/run-program.lisp
+++ b/src/code/run-program.lisp
@@ -742,7 +742,8 @@
 					 #o666)))
 		(unix:unix-unlink name)
 		(when fd
-		  (let ((newline (string #\Newline)))
+		  (let ((newline (make-array 1 :element-type '(unsigned-byte 8)
+					     :initial-element (char-code #\Newline))))
 		    (loop
 		      (multiple-value-bind
 			  (line no-cr)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/f10c6b6fbb035c89f37610fa30fc429ab857d5fc...3b4745d3ee7f69b08fd3ba1dcd8d436e17650b7c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20161208/f2e8e219/attachment.html>


More information about the cmucl-cvs mailing list