[elephant-cvs] CVS elephant/src/memutil

ieslick ieslick at common-lisp.net
Mon Jul 3 00:36:37 UTC 2006


Update of /project/elephant/cvsroot/elephant/src/memutil
In directory clnet:/tmp/cvs-serv10733

Modified Files:
	memutil.lisp 
Log Message:
Added error checking for failure to allocate large buffer streams.  Previously it failed silently.

--- /project/elephant/cvsroot/elephant/src/memutil/memutil.lisp	2006/06/19 01:31:59	1.7
+++ /project/elephant/cvsroot/elephant/src/memutil/memutil.lisp	2006/07/03 00:36:37	1.8
@@ -443,6 +443,8 @@
 	(declare (type fixnum newlen))
 	(let ((newbuf (allocate-foreign-object :char newlen)))
 	  ;; technically we just need to copy from position to size.....
+	  (when (null-pointer-p newbuf)
+	    (error "Failed to allocate buffer stream of length ~A.  allocate-foreign-object returned a null pointer" newlen))
 	  (copy-bufs newbuf 0 buf 0 size)
 	  (free-foreign-object buf)
 	  (setf buf newbuf)
@@ -462,6 +464,8 @@
       (let ((newlen (max length (* len 2))))
 	(declare (type fixnum newlen))
 	(let ((newbuf (allocate-foreign-object :char newlen)))
+	  (when (null-pointer-p newbuf)
+	    (error "Failed to allocate buffer stream of length ~A.  allocate-foreign-object returned a null pointer" newlen))
 	  (free-foreign-object buf)
 	  (setf buf newbuf)
 	  (setf len newlen)




More information about the Elephant-cvs mailing list