utils.lisp 432 B

1234567891011121314151617
  1. (in-package :hurd)
  2. (defun %idptr-to-list (ptr size)
  3. "Transforms a foreign array 'ptr' with 'size' elements into a list."
  4. (loop for i from 0 below size
  5. collect (mem-aref ptr :unsigned-int i)))
  6. (defun %free-idptr (ptr size)
  7. "Free's a foreign array with 'size' elements."
  8. (let ((ptr ptr))
  9. (loop for i from 0 below size
  10. do (progn
  11. (foreign-free ptr)
  12. (incf-pointer ptr)))))