Skip to content

Commit

Permalink
Use with-slots
Browse files Browse the repository at this point in the history
  • Loading branch information
ruricolist committed Jan 16, 2025
1 parent b5a3d9f commit b012313
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions attrs.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,13 @@ This implements the subroot map copy-on-write behavior: after this
function is called, the root of ATTRs will have its own subroot map."
(let ((root (attrs-root attrs)))
(assert (slot-exists-p root 'subroot-map))
(if (slot-boundp root 'subroot-map)
(let ((value (slot-value root 'subroot-map)))
(if (typep value 'subroot-map) value
(setf (slot-value root 'subroot-map)
(copy-subroot-map (unbox value)))))
(setf (slot-value root 'subroot-map)
(make-subroot-map)))))
(with-slots (subroot-map) root
(if (slot-boundp root 'subroot-map)
(if (typep subroot-map 'subroot-map)
subroot-map
(setf subroot-map
(copy-subroot-map (unbox subroot-map))))
(setf subroot-map (make-subroot-map))))))

(defsubst attrs.subroot->attr-table (attrs)
"Ensure the subroots table for ATTRS."
Expand Down

0 comments on commit b012313

Please sign in to comment.