From 5218b2023faf63873a1023b969d187ab7704fe4c Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Wed, 23 Nov 2022 09:59:42 +0100 Subject: [PATCH] [nop] Misc housekeeping --- src/taoensso/nippy.clj | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/taoensso/nippy.clj b/src/taoensso/nippy.clj index b43ee6ca..84917031 100644 --- a/src/taoensso/nippy.clj +++ b/src/taoensso/nippy.clj @@ -34,6 +34,10 @@ ;;;; TODO ;; - Performance would benefit from ^:static support / direct linking / etc. +;; - Counts could actually be unsigned (e.g. -sm as [0,255] instead of [-128,127]). +;; Would require a breaking change (e.g. version 2 header), probably not worth +;; the effort. +;; - Could use different ids for pos/neg numbers, and thus encode both as unsigned ;;;; Nippy data format ;; * 4-byte header (Nippy v2.x+) (may be disabled but incl. by default) [1] @@ -407,18 +411,20 @@ (defn- init-allowlist [action default incl-legacy?] (let [allowlist-base (or - (when-let [s (or - (enc/get-sys-val (get-in ids [action :base :prop]) (get-in ids [action :base :env])) - (when incl-legacy? - (enc/get-sys-val (get-in ids [:legacy :base :prop]) (get-in ids [:legacy :base :env]))))] + (when-let [s + (or + (do (enc/get-sys-val (get-in ids [action :base :prop]) (get-in ids [action :base :env]))) + (when incl-legacy? (enc/get-sys-val (get-in ids [:legacy :base :prop]) (get-in ids [:legacy :base :env]))))] + (if (allow-and-record? s) s (split-class-names>set s))) default) allowlist-add - (when-let [s (or - (enc/get-sys-val (get-in ids [action :add :prop]) (get-in ids [action :add :env])) - (when incl-legacy? - (enc/get-sys-val (get-in ids [:legacy :add :prop]) (get-in ids [:legacy :add :env]))))] + (when-let [s + (or + (do (enc/get-sys-val (get-in ids [action :add :prop]) (get-in ids [action :add :env]))) + (when incl-legacy? (enc/get-sys-val (get-in ids [:legacy :add :prop]) (get-in ids [:legacy :add :env]))))] + (if (allow-and-record? s) s (split-class-names>set s)))] (if (and allowlist-base allowlist-add)