]> git.eshelyaron.com Git - emacs.git/commitdiff
(hash-table-contains-p): Don't allocate memory (bug#78162)
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 12 May 2025 21:20:12 +0000 (17:20 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 14 May 2025 12:33:25 +0000 (14:33 +0200)
* 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 <mail@daniel-mendler.de>.

(cherry picked from commit 872658764823bb805796002c46c0e6e4456e65b7)

lisp/subr.el

index 62f395fc27d55a09524f0c546c2fa0640957c97c..bbd0b32a31cff5785ed239f56582c5d277a66869 100644 (file)
@@ -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.