uffi/tests compress.lisp,1.6,1.7 gethostname.lisp,1.4,1.5
"Kevin M. Rosenberg" <[email protected]> Tue, 29 Apr 2003 08:13:57 -0600
| Newsgroups | gmane.lisp.uffi.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /pubcvs/uffi/tests
In directory boa.b9.com:/tmp/cvs-serv17335/tests
Modified Files:
compress.lisp gethostname.lisp
Log Message:
Auto commit for Debian build
Index: compress.lisp
===================================================================
RCS file: /pubcvs/uffi/tests/compress.lisp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** compress.lisp 29 Apr 2003 13:16:14 -0000 1.6
--- compress.lisp 29 Apr 2003 14:13:55 -0000 1.7
***************
*** 101,105 ****
--- 101,107 ----
(defun compress-uncompress (str)
(multiple-value-bind (compressed len) (compress str)
+ (declare (ignore len))
(multiple-value-bind (uncompressed len2) (uncompress compressed)
+ (declare (ignore len2))
uncompressed)))
Index: gethostname.lisp
===================================================================
RCS file: /pubcvs/uffi/tests/gethostname.lisp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** gethostname.lisp 29 Apr 2003 14:08:02 -0000 1.4
--- gethostname.lisp 29 Apr 2003 14:13:55 -0000 1.5
***************
*** 22,47 ****
;;; This example is inspired by the example on the CL-Cookbook web site
! (uffi:def-function ("gethostname" c-gethostname)
! ((name (* :unsigned-char))
! (len :int))
! :returning :int)
!
! (defun gethostname ()
! "Returns the hostname"
! (let* ((name (uffi:allocate-foreign-string 256))
! (result-code (c-gethostname name 256))
! (hostname (when (zerop result-code)
! (uffi:convert-from-foreign-string name))))
! (uffi:free-foreign-object name)
! (unless (zerop result-code)
! (error "gethostname() failed."))
! hostname))
!
! (defun gethostname2 ()
! "Returns the hostname"
! (uffi:with-foreign-object (name '(:array :unsigned-char 256))
! (if (zerop (c-gethostname (uffi:char-array-to-pointer name) 256))
! (uffi:convert-from-foreign-string name)
! (error "gethostname() failed."))))
(deftest gethostname.1 (stringp (gethostname)) t)
--- 22,48 ----
;;; This example is inspired by the example on the CL-Cookbook web site
! (eval-when (:compile-toplevel :load-toplevel :execute)
! (uffi:def-function ("gethostname" c-gethostname)
! ((name (* :unsigned-char))
! (len :int))
! :returning :int)
!
! (defun gethostname ()
! "Returns the hostname"
! (let* ((name (uffi:allocate-foreign-string 256))
! (result-code (c-gethostname name 256))
! (hostname (when (zerop result-code)
! (uffi:convert-from-foreign-string name))))
! (uffi:free-foreign-object name)
! (unless (zerop result-code)
! (error "gethostname() failed."))
! hostname))
!
! (defun gethostname2 ()
! "Returns the hostname"
! (uffi:with-foreign-object (name '(:array :unsigned-char 256))
! (if (zerop (c-gethostname (uffi:char-array-to-pointer name) 256))
! (uffi:convert-from-foreign-string name)
! (error "gethostname() failed.")))))
(deftest gethostname.1 (stringp (gethostname)) t)