]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/eieio-base.el
Fix race conditions with MS-Windows lock files by using _sopen.
[gnu-emacs] / lisp / emacs-lisp / eieio-base.el
index 24d680181bb71c80b1a01ed88f470fc245f1300c..c8ae3f4bf1a7a76a0bd7ddada7b694daa4aa4048 100644 (file)
@@ -65,19 +65,19 @@ SLOT-NAME is the offending slot.  FN is the function signaling the error."
   "Clone OBJ, initializing `:parent' to OBJ.
 All slots are unbound, except those initialized with PARAMS."
   (let ((nobj (make-vector (length obj) eieio-unbound))
-       (nm (aref obj object-name))
+       (nm (eieio--object-name obj))
        (passname (and params (stringp (car params))))
        (num 1))
     (aset nobj 0 'object)
-    (aset nobj object-class (aref obj object-class))
+    (setf (eieio--object-class nobj) (eieio--object-class obj))
     ;; The following was copied from the default clone.
     (if (not passname)
        (save-match-data
          (if (string-match "-\\([0-9]+\\)" nm)
              (setq num (1+ (string-to-number (match-string 1 nm)))
                    nm (substring nm 0 (match-beginning 0))))
-         (aset nobj object-name (concat nm "-" (int-to-string num))))
-      (aset nobj object-name (car params)))
+         (setf (eieio--object-name nobj) (concat nm "-" (int-to-string num))))
+      (setf (eieio--object-name nobj) (car params)))
     ;; Now initialize from params.
     (if params (shared-initialize nobj (if passname (cdr params) params)))
     (oset nobj parent-instance obj)
@@ -232,8 +232,7 @@ for CLASS.  Optional ALLOW-SUBCLASS says that it is ok for
 being pedantic."
   (unless class
     (message "Unsafe call to `eieio-persistent-read'."))
-  (when (and class (not (class-p class)))
-    (signal 'wrong-type-argument (list 'class-p class)))
+  (when class (eieio--check-type class-p class))
   (let ((ret nil)
        (buffstr nil))
     (unwind-protect
@@ -308,7 +307,7 @@ Second, any text properties will be stripped from strings."
               (type nil)
               (classtype nil))
           (setq slot-idx (- slot-idx 3))
-          (setq type (aref (aref (class-v class) class-public-type)
+          (setq type (aref (eieio--class-public-type (class-v class))
                            slot-idx))
 
           (setq classtype (eieio-persistent-slot-type-is-class-p
@@ -482,14 +481,13 @@ Argument SLOT-NAME is the slot that was attempted to be accessed.
 OPERATION is the type of access, such as `oref' or `oset'.
 NEW-VALUE is the value that was being set into SLOT if OPERATION were
 a set type."
-  (if (or (eq slot-name 'object-name)
-         (eq slot-name :object-name))
+  (if (memq slot-name '(object-name :object-name))
       (cond ((eq operation 'oset)
             (if (not (stringp new-value))
                 (signal 'invalid-slot-type
                         (list obj slot-name 'string new-value)))
-            (object-set-name-string obj new-value))
-           (t (object-name-string obj)))
+            (eieio-object-set-name-string obj new-value))
+           (t (eieio-object-name-string obj)))
     (call-next-method)))
 
 (provide 'eieio-base)