emacs-diffs
[Top][All Lists]
Advanced

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

scratch/obarray 0e821664f89 4/9: use obarray-make instead of make-vector


From: Mattias Engdegård
Subject: scratch/obarray 0e821664f89 4/9: use obarray-make instead of make-vector
Date: Mon, 12 Feb 2024 09:10:53 -0500 (EST)

branch: scratch/obarray
commit 0e821664f89620e975d8f2a9efc34492a9350943
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    use obarray-make instead of make-vector
---
 lisp/cedet/semantic/lex-spp.el | 6 +++---
 lisp/cedet/semantic/lex.el     | 4 ++--
 lisp/completion.el             | 8 ++++----
 lisp/emacs-lisp/checkdoc.el    | 2 +-
 lisp/emacs-lisp/eldoc.el       | 4 ++--
 lisp/mail/mail-extr.el         | 2 +-
 lisp/mail/rmailkwd.el          | 2 +-
 lisp/net/dns.el                | 2 +-
 lisp/net/eww.el                | 2 +-
 lisp/net/imap.el               | 8 ++++----
 lisp/obsolete/pgg.el           | 4 ++--
 lisp/play/cookie1.el           | 2 +-
 lisp/progmodes/cc-defs.el      | 4 ++--
 lisp/progmodes/cc-langs.el     | 2 +-
 lisp/vc/vc-hooks.el            | 2 +-
 test/lisp/obarray-tests.el     | 3 ++-
 test/src/minibuf-tests.el      | 2 +-
 17 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index a4be5bf67e2..f63d316c1ac 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -153,13 +153,13 @@ The search priority is:
   "Return the dynamic macro map for the current buffer."
   (or semantic-lex-spp-dynamic-macro-symbol-obarray
       (setq semantic-lex-spp-dynamic-macro-symbol-obarray
-           (make-vector 13 0))))
+           (obarray-make 13))))
 
 (defsubst semantic-lex-spp-dynamic-map-stack ()
   "Return the dynamic macro map for the current buffer."
   (or semantic-lex-spp-dynamic-macro-symbol-obarray-stack
       (setq semantic-lex-spp-dynamic-macro-symbol-obarray-stack
-           (make-vector 13 0))))
+           (obarray-make 13))))
 
 (defun semantic-lex-spp-value-valid-p (value)
   "Return non-nil if VALUE is valid."
@@ -260,7 +260,7 @@ NAME is the name of the spp macro symbol to define.
 REPLACEMENT a string that would be substituted in for NAME."
 
   ;; Create the symbol hash table
-  (let ((semantic-lex-spp-macro-symbol-obarray (make-vector 13 0))
+  (let ((semantic-lex-spp-macro-symbol-obarray (obarray-make 13))
         spec)
     ;; fill it with stuff
     (while specs
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index b32cb96bed9..f3d671ac312 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -259,7 +259,7 @@ If optional argument PROPSPECS is non-nil, then interpret 
it, and
 apply those properties.
 PROPSPECS must be a list of (NAME PROPERTY VALUE) elements."
   ;; Create the symbol hash table
-  (let ((semantic-flex-keywords-obarray (make-vector 13 0))
+  (let ((semantic-flex-keywords-obarray (obarray-make 13))
         spec)
     ;; fill it with stuff
     (while specs
@@ -416,7 +416,7 @@ If optional argument PROPSPECS is non-nil, then interpret 
it, and
 apply those properties.
 PROPSPECS must be a list of (TYPE PROPERTY VALUE)."
   ;; Create the symbol hash table
-  (let* ((semantic-lex-types-obarray (make-vector 13 0))
+  (let* ((semantic-lex-types-obarray (obarray-make 13))
          spec type tokens token alist default)
     ;; fill it with stuff
     (while specs
diff --git a/lisp/completion.el b/lisp/completion.el
index ab7f2a7bc52..6c758e56eab 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -875,11 +875,11 @@ This is sensitive to `case-fold-search'."
 ;; GNU implements obarrays
 (defconst cmpl-obarray-length 511)
 
-(defvar cmpl-prefix-obarray (make-vector cmpl-obarray-length 0)
+(defvar cmpl-prefix-obarray (obarray-make cmpl-obarray-length)
   "An obarray used to store the downcased completion prefixes.
 Each symbol is bound to a list of completion entries.")
 
-(defvar cmpl-obarray (make-vector cmpl-obarray-length 0)
+(defvar cmpl-obarray (obarray-make cmpl-obarray-length)
   "An obarray used to store the downcased completions.
 Each symbol is bound to a single completion entry.")
 
@@ -962,8 +962,8 @@ Each symbol is bound to a single completion entry.")
 (defun clear-all-completions ()
   "Initialize the completion storage.  All existing completions are lost."
   (interactive)
-  (setq cmpl-prefix-obarray (make-vector cmpl-obarray-length 0))
-  (setq cmpl-obarray (make-vector cmpl-obarray-length 0)))
+  (setq cmpl-prefix-obarray (obarray-make cmpl-obarray-length))
+  (setq cmpl-obarray (obarray-make cmpl-obarray-length)))
 
 (defun list-all-completions ()
   "Return a list of all the known completion entries."
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 82c6c03a592..02c11cae573 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1994,7 +1994,7 @@ from the comment."
           (defun-depth (ppss-depth (syntax-ppss)))
          (lst nil)
          (ret nil)
-         (oo (make-vector 3 0)))       ;substitute obarray for `read'
+         (oo (obarray-make 3)))        ;substitute obarray for `read'
       (forward-char 1)
       (forward-sexp 1)
       (skip-chars-forward " \n\t")
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 912a7357ca7..24afd03fbe6 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -155,7 +155,7 @@ Remember to keep it a prime number to improve hash 
performance.")
 
 (defvar eldoc-message-commands
   ;; Don't define as `defconst' since it would then go to (read-only) 
purespace.
-  (make-vector eldoc-message-commands-table-size 0)
+  (obarray-make eldoc-message-commands-table-size)
   "Commands after which it is appropriate to print in the echo area.
 ElDoc does not try to print function arglists, etc., after just any command,
 because some commands print their own messages in the echo area and these
@@ -191,7 +191,7 @@ It should receive the same arguments as `message'.")
 
 When `eldoc-print-after-edit' is non-nil, ElDoc messages are only
 printed after commands contained in this obarray."
-  (let ((cmds (make-vector 31 0))
+  (let ((cmds (obarray-make 31))
        (re (regexp-opt '("delete" "insert" "edit" "electric" "newline"))))
     (mapatoms (lambda (s)
                (and (commandp s)
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el
index 668cae05521..cfdbc1b2509 100644
--- a/lisp/mail/mail-extr.el
+++ b/lisp/mail/mail-extr.el
@@ -1845,7 +1845,7 @@ place.  It affects how `mail-extract-address-components' 
works."
 ;; https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
 
 (defconst mail-extr-all-top-level-domains
-  (let ((ob (make-vector 739 0)))
+  (let ((ob (obarray-make 739)))
     (mapc
      (lambda (x)
        (put (intern (downcase (car x)) ob)
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el
index d9c4cb8cfee..a13c42edb5c 100644
--- a/lisp/mail/rmailkwd.el
+++ b/lisp/mail/rmailkwd.el
@@ -31,7 +31,7 @@
 ;; Global to all RMAIL buffers.  It exists for the sake of completion.
 ;; It is better to use strings with the label functions and let them
 ;; worry about making the label.
-(defvar rmail-label-obarray (make-vector 47 0)
+(defvar rmail-label-obarray (obarray-make 47)
   "Obarray of labels used by Rmail.
 `rmail-read-label' uses this to offer completion.")
 
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index 23ea88ef4ad..54f4d227a49 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -359,7 +359,7 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
     result))
 
 ;;; Interface functions.
-(defvar dns-cache (make-vector 4096 0))
+(defvar dns-cache (obarray-make 4096))
 
 (defun dns-query-cached (name &optional type fullp reversep)
   (let* ((key (format "%s:%s:%s:%s" name type fullp reversep))
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 6ae1e6d3d0a..5a25eef9e3c 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -340,7 +340,7 @@ parameter, and should return the (possibly) transformed 
URL."
 (defun eww-suggested-uris nil
   "Return the list of URIs to suggest at the `eww' prompt.
 This list can be customized via `eww-suggest-uris'."
-  (let ((obseen (make-vector 42 0))
+  (let ((obseen (obarray-make 42))
        (uris nil))
     (dolist (fun eww-suggest-uris)
       (let ((ret (funcall fun)))
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index f10b5b8fc12..a06740528e9 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -1057,7 +1057,7 @@ necessary.  If nil, the buffer name is generated."
                (setq imap-capability nil)
                (setq streams nil))))))
       (when (imap-opened buffer)
-       (setq imap-mailbox-data (make-vector imap-mailbox-prime 0)))
+       (setq imap-mailbox-data (obarray-make imap-mailbox-prime)))
       ;; (debug "opened+state+auth+buffer" (imap-opened buffer) imap-state 
imap-auth buffer)
       (when imap-stream
        buffer))))
@@ -1280,7 +1280,7 @@ If EXAMINE is non-nil, do a read-only select."
                    (concat (if examine "EXAMINE" "SELECT") " \""
                            mailbox "\"")))
        (progn
-         (setq imap-message-data (make-vector imap-message-prime 0)
+         (setq imap-message-data (obarray-make imap-message-prime)
                imap-state (if examine 'examine 'selected))
          imap-current-mailbox)
       ;; Failed SELECT/EXAMINE unselects current mailbox
@@ -1722,7 +1722,7 @@ See `imap-enable-exchange-bug-workaround'."
            (string-to-number (nth 2 (imap-mailbox-get-1 'copyuid mailbox))))
     (let ((old-mailbox imap-current-mailbox)
          (state imap-state)
-         (imap-message-data (make-vector 2 0)))
+         (imap-message-data (obarray-make 2)))
       (when (imap-mailbox-examine-1 mailbox)
        (prog1
            (and (imap-fetch-safe '("*" . "*:*") "UID")
@@ -1768,7 +1768,7 @@ first element.  The rest of list contains the saved 
articles' UIDs."
       (imap-mailbox-get-1 'appenduid mailbox)
     (let ((old-mailbox imap-current-mailbox)
          (state imap-state)
-         (imap-message-data (make-vector 2 0)))
+         (imap-message-data (obarray-make 2)))
       (when (imap-mailbox-examine-1 mailbox)
        (prog1
            (and (imap-fetch-safe '("*" . "*:*") "UID")
diff --git a/lisp/obsolete/pgg.el b/lisp/obsolete/pgg.el
index 6c00ad201f1..4c7b653155e 100644
--- a/lisp/obsolete/pgg.el
+++ b/lisp/obsolete/pgg.el
@@ -85,9 +85,9 @@ is true, or else the output buffer is displayed."
       (set-buffer standard-output)
       (insert-buffer-substring pgg-errors-buffer))))
 
-(defvar pgg-passphrase-cache (make-vector 7 0))
+(defvar pgg-passphrase-cache (obarray-make 7))
 
-(defvar pgg-pending-timers (make-vector 7 0)
+(defvar pgg-pending-timers (obarray-make 7)
   "Hash table for managing scheduled pgg cache management timers.
 
 We associate key and timer, so the timer can be canceled if a new
diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el
index c8e9d097a5f..c4697a0d3b9 100644
--- a/lisp/play/cookie1.el
+++ b/lisp/play/cookie1.el
@@ -65,7 +65,7 @@
 (defconst cookie-delimiter "\n%%\n\\|\n%\n\\|\0"
   "Delimiter used to separate cookie file entries.")
 
-(defvar cookie-cache (make-vector 511 0)
+(defvar cookie-cache (obarray-make 511)
   "Cache of cookie files that have already been snarfed.")
 
 (defun cookie-check-file (file)
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index f84d95dbc94..e45ab76ec07 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -2425,7 +2425,7 @@ system."
     (error "Unknown base mode `%s'" base-mode))
   (put mode 'c-fallback-mode base-mode))
 
-(defvar c-lang-constants (make-vector 151 0))
+(defvar c-lang-constants (obarray-make 151))
 ;;   Obarray used as a cache to keep track of the language constants.
 ;; The constants stored are those defined by `c-lang-defconst' and the values
 ;; computed by `c-lang-const'.  It's mostly used at compile time but it's not
@@ -2630,7 +2630,7 @@ constant.  A file is identified by its base name."
 
     ;; Clear the evaluated values that depend on this source.
     (let ((agenda (get sym 'dependents))
-         (visited (make-vector 101 0))
+         (visited (obarray-make 101))
          ptr)
       (while agenda
        (setq sym (car agenda)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index ba0d1d0fc49..ae2389c75c2 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -3511,7 +3511,7 @@ Note that Java specific rules are currently applied to 
tell this from
 
   (let* ((alist (c-lang-const c-keyword-member-alist))
         kwd lang-const-list
-        (obarray (make-vector (* (length alist) 2) 0)))
+        (obarray (obarray-make (* (length alist) 2))))
     (while alist
       (setq kwd (caar alist)
            lang-const-list (cdar alist)
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 1493845e2d9..a95cc732dab 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -197,7 +197,7 @@ VC commands are globally reachable under the prefix 
\\[vc-prefix-map]:
 ;; during any subsequent VC operations, and forget them when
 ;; the buffer is killed.
 
-(defvar vc-file-prop-obarray (make-vector 17 0)
+(defvar vc-file-prop-obarray (obarray-make 17)
   "Obarray for per-file properties.")
 
 (defvar vc-touched-properties nil)
diff --git a/test/lisp/obarray-tests.el b/test/lisp/obarray-tests.el
index d7e547fcf29..dd8f1c8abd4 100644
--- a/test/lisp/obarray-tests.el
+++ b/test/lisp/obarray-tests.el
@@ -32,7 +32,8 @@
   (should-not (obarrayp "aoeu"))
   (should-not (obarrayp '()))
   (should-not (obarrayp []))
-  (should (obarrayp (make-vector 7 0))))
+  (should (obarrayp (obarray-make 7)))
+  (should (obarrayp (make-vector 7 0)))) ; for compatibility?
 
 (ert-deftest obarrayp-unchecked-content-test ()
   "Should fail to check content of passed obarray."
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el
index cb305ca0e55..99d522d1856 100644
--- a/test/src/minibuf-tests.el
+++ b/test/src/minibuf-tests.el
@@ -34,7 +34,7 @@
   (let ((num 0))
     (mapcar (lambda (str) (cons str (cl-incf num))) list)))
 (defun minibuf-tests--strings-to-obarray (list)
-  (let ((ob (make-vector 7 0)))
+  (let ((ob (obarray-make 7)))
     (mapc (lambda (str) (intern str ob)) list)
     ob))
 (defun minibuf-tests--strings-to-string-hashtable (list)



reply via email to

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