mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Remove extra padding element from simple-character-string
There is no convention for UCS-4 strings to be terminated by 4 zero bytes. Unlike with ASCII strings, it doesn't make Lisp more C-compatible.
This commit is contained in:
parent
3247cefe3b
commit
672e7258d2
|
|
@ -78,7 +78,6 @@
|
|||
:complex-typecode #.complex-base-string-widetag)
|
||||
#+sb-unicode
|
||||
(character ,(code-char 0) 32 simple-character-string
|
||||
:n-pad-elements 1
|
||||
:complex-typecode #.complex-character-string-widetag)
|
||||
(single-float $0.0f0 32 simple-array-single-float)
|
||||
(double-float $0.0d0 64 simple-array-double-float)
|
||||
|
|
|
|||
|
|
@ -938,12 +938,11 @@ NWORDS(uword_t x, uword_t n_bits)
|
|||
|
||||
DEF_SPECIALIZED_VECTOR(vector_nil, 0*length)
|
||||
DEF_SPECIALIZED_VECTOR(vector_bit, NWORDS(length,1))
|
||||
/* NOTE: strings contain one more element of data (a terminating '\0'
|
||||
/* NOTE: base strings contain one more element of data (a terminating '\0'
|
||||
* to help interface with C functions) than indicated by the length slot.
|
||||
* This is true even for UCS4 strings, despite that C APIs are unlikely
|
||||
* to have a convention that expects 4 zero bytes. */
|
||||
* UCS4 strings do not get a terminator element */
|
||||
DEF_SPECIALIZED_VECTOR(base_string, NWORDS((length+1), 8))
|
||||
DEF_SPECIALIZED_VECTOR(character_string, NWORDS((length+1), 32))
|
||||
DEF_SPECIALIZED_VECTOR(character_string, NWORDS(length, 32))
|
||||
DEF_SCAV_TRANS_SIZE_UB(2)
|
||||
DEF_SCAV_TRANS_SIZE_UB(4)
|
||||
DEF_SCAV_TRANS_SIZE_UB(8)
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@
|
|||
(checked-compile-and-assert (:optimize '(:safety 0))
|
||||
`(lambda (x)
|
||||
;; Strings are null-terminated for C interoperability
|
||||
(char "abcd" x))
|
||||
(char #.(coerce "abcd" 'simple-base-string) x))
|
||||
((4) #\Nul)))
|
||||
|
||||
(with-test (:name (adjust-array :transform))
|
||||
|
|
|
|||
Loading…
Reference in a new issue