emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pam 0f1f5cf265 10/16: Use cl-loop instead of queue pack


From: ELPA Syncer
Subject: [elpa] externals/pam 0f1f5cf265 10/16: Use cl-loop instead of queue package
Date: Wed, 20 Sep 2023 12:59:11 -0400 (EDT)

branch: externals/pam
commit 0f1f5cf265f0f6baa1848d57a9642985b75f82d0
Author: Onnie Lynn Winebarger <owinebar@gmail.com>
Commit: Onnie Lynn Winebarger <owinebar@gmail.com>

    Use cl-loop instead of queue package
---
 tam.el | 38 ++++++++++++--------------------------
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/tam.el b/tam.el
index d7bdb4ef87..5051b69cb2 100644
--- a/tam.el
+++ b/tam.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Onnie Lynn Winebarger <owinebar@gmail.com>
 ;; Version: 0.1
 ;; URL: https://github.com/owinebar/emacs-table-allocation-manager
-;; Package-Requires: ((queue "0.2") (emacs "24.3"))
+;; Package-Requires: ((emacs "24.4"))
 ;; Readme: Readme.md
 
 ;; This file is part of GNU Emacs.
@@ -57,8 +57,6 @@
 (eval-when-compile
   (require 'cl-lib))
 
-(require 'queue)
-
 (cl-defstruct (tam--table (:constructor tam--table-create (size))
                          (:copier tam--copy-table))
   "Table with explicitly managed allocation"
@@ -116,14 +114,8 @@
   "Test if TBL is empty."
   (= (tam--table-used tbl) 0))
 
-(defsubst tam-table-size (tbl)
-  "Number of slots in TBL."
-  (tam--table-size tbl))
-
-
-(defsubst tam-table-used (tbl)
-  "Number of slots of TBL in use."
-  (tam--table-used tbl))
+(defalias 'tam-table-size #'tam--table-size)
+(defalias 'tam-table-used #'tam--table-used)
 
 (defun tam--table-get-slot (tbl idx)
   "Get slot IDX of TBL."
@@ -136,7 +128,7 @@
 
 (defun tam-allocate (tbl obj)
   "Allocate slot in TBL with contents OBJ.
-Returns index or nil if table is full."
+Return index or nil if table is full."
   (let ((s (tam--table-first-free tbl))
        next idx)
     (when (not (tam-table-fullp tbl))
@@ -159,8 +151,8 @@ Returns index or nil if table is full."
     idx))
 
 (defun tam-free (tbl idx)
-  "Free slot at IDX in TBL.  Return contents of slot IDX.
-Signals an error if IDX is not in use."
+  "Free slot at IDX in TBL.
+Return contents of slot IDX.  Signals an error if IDX is not in use."
   (let ((s (tam--table-get-slot tbl idx))
        (last-free (tam--table-last-free tbl))
        prev next obj)
@@ -195,21 +187,15 @@ Signals an error if IDX is not in use."
 
 (defun tam-table-free-list (tbl)
   "Return list of free indices in TBL."
-  (let ((s (tam--table-first-free tbl))
-       (q (queue-create)))
-    (while s
-      (queue-enqueue q (tam--slot-index s))
-      (setq s (tam--slot-next s)))
-    (queue-all q)))
+  (cl-loop for s = (tam--table-first-free tbl) then (tam--slot-next s)
+          while s
+          collect (tam--slot-index s)))
 
 (defun tam-table-live-list (tbl)
   "Return list of live indices in TBL."
-  (let ((s (tam--table-first-used tbl))
-       (q (queue-create)))
-    (while s
-      (queue-enqueue q (tam--slot-index s))
-      (setq s (tam--slot-next s)))
-    (queue-all q)))
+  (cl-loop for s = (tam--table-first-used tbl) then (tam--slot-next s)
+          while s
+          collect (tam--slot-index s)))
 
 
 (provide 'tam)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]