uffi/examples gethostname.lisp,1.1,1.2

"Kevin M. Rosenberg" <[email protected]> Mon, 25 Nov 2002 12:04:59 -0700
Newsgroups gmane.lisp.uffi.cvs
Message-ID <[email protected]>
Update of /pubcvs/uffi/examples
In directory boa.b9.com:/tmp/cvs-serv29820

Modified Files:
	gethostname.lisp 
Log Message:



Index: gethostname.lisp
===================================================================
RCS file: /pubcvs/uffi/examples/gethostname.lisp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** gethostname.lisp	30 Sep 2002 10:02:36 -0000	1.1
--- gethostname.lisp	25 Nov 2002 19:04:57 -0000	1.2
***************
*** 30,39 ****
    "Returns the hostname"
    (let* ((name (uffi:allocate-foreign-string 256))
! 	 (result (c-gethostname name 256)))
!     (unwind-protect
! 	(if (zerop result)
! 	    (uffi:convert-from-foreign-string name)
! 	  (error "gethostname() failed."))
!       (uffi:free-foreign-object name))))
  
  (defun gethostname2 ()
--- 30,39 ----
    "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."))))
  
  (defun gethostname2 ()