From 72298c955f2763de0015aa008d973afa2000c2c8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 12 May 2025 17:20:12 -0400 Subject: [PATCH] (hash-table-contains-p): Don't allocate memory (bug#78162) * lisp/subr.el (static-when): Remove spurious extra `progn` and improve warning message's location info. (hash-table-contains-p): Don't allocate memory (bug#78162). Suggested by Daniel Mendler . (cherry picked from commit 872658764823bb805796002c46c0e6e4456e65b7) --- lisp/subr.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 62f395fc27d..bbd0b32a31c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6893,11 +6893,11 @@ TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"." (declare (important-return-value t)) (string-trim-left (string-trim-right string trim-right) trim-left)) -(defsubst hash-table-contains-p (key table) - "Return non-nil if TABLE has an element with KEY." - (declare (side-effect-free t) - (important-return-value t)) - (let ((missing (make-symbol "missing"))) +(let ((missing (make-symbol "missing"))) + (defsubst hash-table-contains-p (key table) + "Return non-nil if TABLE has an element with KEY." + (declare (side-effect-free t) + (important-return-value t)) (not (eq (gethash key table missing) missing)))) ;; The initial anchoring is for better performance in searching matches. -- 2.39.5