[elephant-cvs] CVS update: elephant/src/serializer.lisp
blee at common-lisp.net
blee at common-lisp.net
Sat Aug 28 06:41:00 UTC 2004
Update of /project/elephant/cvsroot/elephant/src
In directory common-lisp.net:/tmp/cvs-serv22143/src
Modified Files:
serializer.lisp
Log Message:
deserialize can take nil
Date: Sat Aug 28 08:41:00 2004
Author: blee
Index: elephant/src/serializer.lisp
diff -u elephant/src/serializer.lisp:1.3 elephant/src/serializer.lisp:1.4
--- elephant/src/serializer.lisp:1.3 Fri Aug 27 19:32:51 2004
+++ elephant/src/serializer.lisp Sat Aug 28 08:41:00 2004
@@ -56,9 +56,9 @@
;; Constants
(defconstant +fixnum+ (char-code #\f))
+(defconstant +nil+ (char-code #\N))
(defconstant +symbol+ (char-code #\S))
(defconstant +string+ (char-code #\s))
-(defconstant +nil+ (char-code #\N))
(defconstant +persistent+ (char-code #\P))
(defconstant +single-float+ (char-code #\F))
(defconstant +double-float+ (char-code #\D))
@@ -107,6 +107,8 @@
(fixnum
(buffer-write-byte +fixnum+ bs)
(buffer-write-int frob bs))
+ (null
+ (buffer-write-byte +nil+ bs))
(symbol
(let ((s (symbol-name frob)))
(declare (type string s) (dynamic-extent s))
@@ -117,8 +119,6 @@
(buffer-write-byte +string+ bs)
(buffer-write-int (byte-length frob) bs)
(buffer-write-string frob bs))
- (null
- (buffer-write-byte +nil+ bs))
(persistent
(buffer-write-byte +persistent+ bs)
(buffer-write-int (oid frob) bs)
@@ -238,7 +238,8 @@
(defun deserialize (buf)
(declare (optimize (speed 3) (safety 0))
- (type array-or-pointer-char buf))
+ (type (or null array-or-pointer-char) buf))
+ (unless buf (return-from deserialize nil))
(setf (buffer-stream-buffer *in-buf*) buf)
(setf (buffer-stream-position *in-buf*) 0)
(setq *lisp-obj-id* 0)
@@ -249,14 +250,14 @@
(type buffer-stream bs))
(let ((tag (buffer-read-byte bs)))
(declare (type foreign-char tag))
- (cond
+ (cond
((= tag +fixnum+)
(buffer-read-fixnum bs))
+ ((= tag +nil+) nil)
((= tag +symbol+)
(intern (or (buffer-read-string bs (buffer-read-fixnum bs)) "")))
((= tag +string+)
(buffer-read-string bs (buffer-read-fixnum bs)))
- ((= tag +nil+) nil)
((= tag +persistent+)
(get-cached-instance *store-controller*
(buffer-read-fixnum bs)
More information about the Elephant-cvs
mailing list