When creating a C-STRING, leave only as many characters as dictated by the fill pointer

This commit is contained in:
jjgarcia 2005-06-28 13:06:56 +00:00
parent e4da9b1816
commit c5205fb67c
2 changed files with 8 additions and 2 deletions

View file

@ -19,6 +19,9 @@ ECL 0.9g
- DEF-FOREIGN-VAR rewritten to make variables visible from other files and to
dereference also arrays and pointers. (M. Pasternacki)
- When creating a C-STRING, characters after the fill pointer are discarded,
according to people's expectations.
* Compiler changes:
- Generated C functions now have readable names corresponding to appropriate

View file

@ -372,13 +372,16 @@
object)
(defmacro convert-to-cstring (object)
object)
;; This enforces that the string contains only as many characters as the
;; fill-pointer determines Since ECL always sets a 0 character after the
;; last element of a string, this way, the string is always zero-terminated
(copy-seq object))
(defmacro free-cstring (object)
object)
(defmacro with-cstring ((cstring string) &body body)
`(let ((,cstring ,string)) ,@body))
`(let ((,cstring (copy-seq ,string))) ,@body))
(defmacro with-cstrings (bindings &rest body)
(if bindings