
Raymond Toy pushed to branch issue-375-mkstemp-return-filename at cmucl / cmucl Commits: 30c30e87 by Raymond Toy at 2025-02-16T18:48:47-08:00 Rename mkstemp.name-returned.2 to mkstemp.non-ascii-name-returned Test name better reflects that we're testing a template with non-ascii characters. - - - - - 4827d17e by Raymond Toy at 2025-02-16T18:48:47-08:00 Rename mkdtemp.name-returned.2 to mkdtemp.non-ascii-name-returned Test name better reflects that we're testing a template with non-ascii characters. - - - - - 70b34d28 by Raymond Toy at 2025-02-16T18:48:47-08:00 Usee system-area-copy to copy the octets to the buffer Better than using our own loop. Also forgot to set the last byte of the buffer to 0 (to terminate the C string) in unix-mkdtemp, so do it now. - - - - - 2 changed files: - src/code/unix.lisp - tests/unix.lisp Changes: ===================================== src/code/unix.lisp ===================================== @@ -2921,8 +2921,10 @@ (with-alien ((buffer (* c-call:unsigned-char))) (setf buffer (make-alien c-call:unsigned-char (1+ length))) ;; Copy the octets from OCTETS to the null-terminated array BUFFER. - (dotimes (k length) - (setf (deref buffer k) (aref octets k))) + (system:without-gcing + (kernel:system-area-copy (vector-sap octets) 0 + (alien-sap buffer) 0 + (* length vm:byte-bits))) (setf (deref buffer length) 0) (syscall ("mkstemp" (* c-call:char)) @@ -2955,8 +2957,12 @@ (with-alien ((buffer (* c-call:unsigned-char))) (setf buffer (make-alien c-call:unsigned-char (1+ length))) ;; Copy the octets from OCTETS to the null-terminated array BUFFER. - (dotimes (k length) - (setf (deref buffer k) (aref octets k))) + (system:without-gcing + (kernel:system-area-copy (vector-sap octets) 0 + (alien-sap buffer) + (* length vm:byte-bits))) + (setf (deref buffer length) 0) + (let ((result (alien-funcall (extern-alien "mkdtemp" (function (* char) ===================================== tests/unix.lisp ===================================== @@ -20,7 +20,7 @@ (when fd (unix:unix-unlink name))))) -(define-test mkstemp.name-returned.2 +(define-test mkstemp.non-ascii-name-returned (:tag :issues) (let ((unix::*filename-encoding* :utf-8) fd name) @@ -84,7 +84,7 @@ (when name (unix:unix-rmdir name))))) -(define-test mkdtemp.name-returned.2 +(define-test mkdtemp.non-ascii-name-returned (:tag :issues) (let ((unix::*filename-encoding* :utf-8) name) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/b65c787bfdbd4ee9d2a8fd4... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/b65c787bfdbd4ee9d2a8fd4... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)