]> git.eshelyaron.com Git - emacs.git/commitdiff
Use obarray-make instead of make-vector to create obarrays
authorMattias EngdegÄrd <mattiase@acm.org>
Thu, 8 Feb 2024 17:23:00 +0000 (18:23 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 28 Feb 2024 17:41:33 +0000 (18:41 +0100)
This prepares for the introduction of an actual obarray type.

* lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-dynamic-map)
(semantic-lex-spp-dynamic-map-stack, semantic-lex-make-spp-table):
* lisp/cedet/semantic/lex.el (semantic-lex-make-keyword-table)
(semantic-lex-make-type-table):
* lisp/completion.el (cmpl-prefix-obarray, cmpl-obarray)
(clear-all-completions):
* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info):
* lisp/emacs-lisp/eldoc.el (eldoc-message-commands)
(eldoc-edit-message-commands):
* lisp/mail/mail-extr.el (mail-extr-all-top-level-domains):
* lisp/mail/rmailkwd.el (rmail-label-obarray):
* lisp/net/dns.el (dns-cache):
* lisp/net/eww.el (eww-suggested-uris):
* lisp/net/imap.el (imap-open, imap-mailbox-select-1)
(imap-message-copyuid-1, imap-message-appenduid-1):
* lisp/obsolete/pgg.el (pgg-passphrase-cache, pgg-pending-timers):
* lisp/play/cookie1.el (cookie-cache):
* lisp/progmodes/cc-defs.el (c-lang-constants, c-define-lang-constant):
* lisp/progmodes/cc-langs.el (c-keywords-obarray):
* lisp/vc/vc-hooks.el (vc-file-prop-obarray):
* test/lisp/obarray-tests.el (obarrayp-test):
* test/src/minibuf-tests.el (minibuf-tests--strings-to-obarray):
Use obarray-make instead of obarray-make.

(cherry picked from commit aa82fe9931851e66aa335e96ae35fd967951b281)

16 files changed:
lisp/cedet/semantic/lex-spp.el
lisp/cedet/semantic/lex.el
lisp/emacs-lisp/checkdoc.el
lisp/emacs-lisp/eldoc.el
lisp/mail/mail-extr.el
lisp/mail/rmailkwd.el
lisp/net/dns.el
lisp/net/eww.el
lisp/net/imap.el
lisp/obsolete/pgg.el
lisp/play/cookie1.el
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-langs.el
lisp/vc/vc-hooks.el
test/lisp/obarray-tests.el
test/src/minibuf-tests.el

index a4be5bf67e2c4cab40cb4599e871582e535c9dae..f63d316c1aca18205ac90d059163b9f7385eeb4c 100644 (file)
@@ -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
index b32cb96bed967c4313da3a2230e7e7d7ab627722..f3d671ac3127f9537046d7d31c7e381735f9ce5e 100644 (file)
@@ -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
index 82c6c03a59242429b6e32eab4c2ca49e4dec3ce5..02c11cae57378b2408d8e2398fcdf51b4d9e03cc 100644 (file)
@@ -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")
index 912a7357ca7a228759c924614576345120ff5b0e..24afd03fbe6b373738d1662e9238e46e772c8089 100644 (file)
@@ -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)
index 668cae05521690553d5b855eebaea6f908e405c1..cfdbc1b25095de7309c11deec232e536b15be6d9 100644 (file)
@@ -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)
index d9c4cb8cfeebd5dc51a7666fd1f4c21b74da9018..a13c42edb5cc5afc1c5ab24a2b96261bb5fa4474 100644 (file)
@@ -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.")
 
index 23ea88ef4ad559efef61bb8a8a1097859a552946..54f4d227a49fe2674ade9f6c352e9322130ed8fe 100644 (file)
@@ -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))
index 6ae1e6d3d0afff5b7ab9433a1814f7880cbaba90..5a25eef9e3cbbee864c911dc66bf6198e4ebbbeb 100644 (file)
@@ -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)))
index f10b5b8fc1213820a75910a32b3ab13a2e14c49c..a06740528e984381513b548ac3f90b84a6c5dd00 100644 (file)
@@ -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")
index 6c00ad201f102a5131b3cdd2dbf90c2de0da9124..4c7b653155e56b83ec59d466d8b21fcab73686a0 100644 (file)
@@ -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
index c8e9d097a5f38e81e23caf67edc225ea27e45c72..c4697a0d3b937c364df2e96bdadca199100aaf8d 100644 (file)
@@ -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)
index f84d95dbc944deb222f1c7967f75a981188186ad..e45ab76ec07ce3ebba6af2a2deaaf1ae4fbac348 100644 (file)
@@ -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)
index ba0d1d0fc49b531eca26c2128c84df4d81447dc5..ae2389c75c2d021925dd6143cc853804e3760660 100644 (file)
@@ -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)
index 1493845e2d9b22aca889dc53388e0a885263984f..a95cc732dab4b3063900f1e68e60efaa6830d2e9 100644 (file)
@@ -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)
index d7e547fcf29630c14ae07422657fa5f4a9312617..dd8f1c8abd4e8e05de198cbb08d8578b07aa3c25 100644 (file)
@@ -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."
index 96a7c052fb7d6d4121b364cd3f239fd6a1842b88..b790c7fa02a7d0fbc9a3913f52a5b9990a432bb5 100644 (file)
@@ -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)