Changeset 419


Ignore:
Timestamp:
Jan 30, 2004, 11:30:14 AM (21 years ago)
Author:
Gary Byers
Message:

WITH-STRING-FROM-CSTRING: stack allocate a lisp-string, getting bytes from
c-string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/macros.lisp

    r404 r419  
    13661366      `(let ((,var ,p)) (%setf-macptr (the macptr ,var) (%inc-ptr ,var ,by))))))
    13671367
     1368(defmacro with-string-from-cstring ((s ptr) &body body)
     1369  (let* ((len (gensym))
     1370         (p (gensym)))
     1371    `(let* ((,p ,ptr)
     1372            (,len (%cstrlen ,p))
     1373            (,s (make-string ,len)))
     1374      (declare (fixnum ,len))
     1375      (%copy-ptr-to-ivector ,p 0 ,s 0 ,len)
     1376      (locally
     1377          ,@body))))
    13681378
    13691379
Note: See TracChangeset for help on using the changeset viewer.