1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

Use obarray-make instead of make-vector to create obarrays

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.
This commit is contained in:
Mattias Engdegård 2024-02-08 18:23:00 +01:00
parent 32843c7b36
commit aa82fe9931
17 changed files with 30 additions and 29 deletions

View file

@ -153,13 +153,13 @@ The search priority is:
"Return the dynamic macro map for the current buffer." "Return the dynamic macro map for the current buffer."
(or semantic-lex-spp-dynamic-macro-symbol-obarray (or semantic-lex-spp-dynamic-macro-symbol-obarray
(setq 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 () (defsubst semantic-lex-spp-dynamic-map-stack ()
"Return the dynamic macro map for the current buffer." "Return the dynamic macro map for the current buffer."
(or semantic-lex-spp-dynamic-macro-symbol-obarray-stack (or semantic-lex-spp-dynamic-macro-symbol-obarray-stack
(setq 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) (defun semantic-lex-spp-value-valid-p (value)
"Return non-nil if VALUE is valid." "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." REPLACEMENT a string that would be substituted in for NAME."
;; Create the symbol hash table ;; 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) spec)
;; fill it with stuff ;; fill it with stuff
(while specs (while specs

View file

@ -259,7 +259,7 @@ If optional argument PROPSPECS is non-nil, then interpret it, and
apply those properties. apply those properties.
PROPSPECS must be a list of (NAME PROPERTY VALUE) elements." PROPSPECS must be a list of (NAME PROPERTY VALUE) elements."
;; Create the symbol hash table ;; Create the symbol hash table
(let ((semantic-flex-keywords-obarray (make-vector 13 0)) (let ((semantic-flex-keywords-obarray (obarray-make 13))
spec) spec)
;; fill it with stuff ;; fill it with stuff
(while specs (while specs
@ -416,7 +416,7 @@ If optional argument PROPSPECS is non-nil, then interpret it, and
apply those properties. apply those properties.
PROPSPECS must be a list of (TYPE PROPERTY VALUE)." PROPSPECS must be a list of (TYPE PROPERTY VALUE)."
;; Create the symbol hash table ;; 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) spec type tokens token alist default)
;; fill it with stuff ;; fill it with stuff
(while specs (while specs

View file

@ -875,11 +875,11 @@ This is sensitive to `case-fold-search'."
;; GNU implements obarrays ;; GNU implements obarrays
(defconst cmpl-obarray-length 511) (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. "An obarray used to store the downcased completion prefixes.
Each symbol is bound to a list of completion entries.") 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. "An obarray used to store the downcased completions.
Each symbol is bound to a single completion entry.") 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 () (defun clear-all-completions ()
"Initialize the completion storage. All existing completions are lost." "Initialize the completion storage. All existing completions are lost."
(interactive) (interactive)
(setq cmpl-prefix-obarray (make-vector cmpl-obarray-length 0)) (setq cmpl-prefix-obarray (obarray-make cmpl-obarray-length))
(setq cmpl-obarray (make-vector cmpl-obarray-length 0))) (setq cmpl-obarray (obarray-make cmpl-obarray-length)))
(defun list-all-completions () (defun list-all-completions ()
"Return a list of all the known completion entries." "Return a list of all the known completion entries."

View file

@ -1994,7 +1994,7 @@ from the comment."
(defun-depth (ppss-depth (syntax-ppss))) (defun-depth (ppss-depth (syntax-ppss)))
(lst nil) (lst nil)
(ret nil) (ret nil)
(oo (make-vector 3 0))) ;substitute obarray for `read' (oo (obarray-make 3))) ;substitute obarray for `read'
(forward-char 1) (forward-char 1)
(forward-sexp 1) (forward-sexp 1)
(skip-chars-forward " \n\t") (skip-chars-forward " \n\t")

View file

@ -155,7 +155,7 @@ Remember to keep it a prime number to improve hash performance.")
(defvar eldoc-message-commands (defvar eldoc-message-commands
;; Don't define as `defconst' since it would then go to (read-only) purespace. ;; 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. "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, 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 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 When `eldoc-print-after-edit' is non-nil, ElDoc messages are only
printed after commands contained in this obarray." 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")))) (re (regexp-opt '("delete" "insert" "edit" "electric" "newline"))))
(mapatoms (lambda (s) (mapatoms (lambda (s)
(and (commandp s) (and (commandp s)

View 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 ;; https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
(defconst mail-extr-all-top-level-domains (defconst mail-extr-all-top-level-domains
(let ((ob (make-vector 739 0))) (let ((ob (obarray-make 739)))
(mapc (mapc
(lambda (x) (lambda (x)
(put (intern (downcase (car x)) ob) (put (intern (downcase (car x)) ob)

View file

@ -31,7 +31,7 @@
;; Global to all RMAIL buffers. It exists for the sake of completion. ;; 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 ;; It is better to use strings with the label functions and let them
;; worry about making the label. ;; 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. "Obarray of labels used by Rmail.
`rmail-read-label' uses this to offer completion.") `rmail-read-label' uses this to offer completion.")

View file

@ -359,7 +359,7 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
result)) result))
;;; Interface functions. ;;; Interface functions.
(defvar dns-cache (make-vector 4096 0)) (defvar dns-cache (obarray-make 4096))
(defun dns-query-cached (name &optional type fullp reversep) (defun dns-query-cached (name &optional type fullp reversep)
(let* ((key (format "%s:%s:%s:%s" name type fullp reversep)) (let* ((key (format "%s:%s:%s:%s" name type fullp reversep))

View file

@ -340,7 +340,7 @@ parameter, and should return the (possibly) transformed URL."
(defun eww-suggested-uris nil (defun eww-suggested-uris nil
"Return the list of URIs to suggest at the `eww' prompt. "Return the list of URIs to suggest at the `eww' prompt.
This list can be customized via `eww-suggest-uris'." This list can be customized via `eww-suggest-uris'."
(let ((obseen (make-vector 42 0)) (let ((obseen (obarray-make 42))
(uris nil)) (uris nil))
(dolist (fun eww-suggest-uris) (dolist (fun eww-suggest-uris)
(let ((ret (funcall fun))) (let ((ret (funcall fun)))

View file

@ -1057,7 +1057,7 @@ necessary. If nil, the buffer name is generated."
(setq imap-capability nil) (setq imap-capability nil)
(setq streams nil)))))) (setq streams nil))))))
(when (imap-opened buffer) (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) ;; (debug "opened+state+auth+buffer" (imap-opened buffer) imap-state imap-auth buffer)
(when imap-stream (when imap-stream
buffer)))) buffer))))
@ -1280,7 +1280,7 @@ If EXAMINE is non-nil, do a read-only select."
(concat (if examine "EXAMINE" "SELECT") " \"" (concat (if examine "EXAMINE" "SELECT") " \""
mailbox "\""))) mailbox "\"")))
(progn (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-state (if examine 'examine 'selected))
imap-current-mailbox) imap-current-mailbox)
;; Failed SELECT/EXAMINE unselects 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)))) (string-to-number (nth 2 (imap-mailbox-get-1 'copyuid mailbox))))
(let ((old-mailbox imap-current-mailbox) (let ((old-mailbox imap-current-mailbox)
(state imap-state) (state imap-state)
(imap-message-data (make-vector 2 0))) (imap-message-data (obarray-make 2)))
(when (imap-mailbox-examine-1 mailbox) (when (imap-mailbox-examine-1 mailbox)
(prog1 (prog1
(and (imap-fetch-safe '("*" . "*:*") "UID") (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) (imap-mailbox-get-1 'appenduid mailbox)
(let ((old-mailbox imap-current-mailbox) (let ((old-mailbox imap-current-mailbox)
(state imap-state) (state imap-state)
(imap-message-data (make-vector 2 0))) (imap-message-data (obarray-make 2)))
(when (imap-mailbox-examine-1 mailbox) (when (imap-mailbox-examine-1 mailbox)
(prog1 (prog1
(and (imap-fetch-safe '("*" . "*:*") "UID") (and (imap-fetch-safe '("*" . "*:*") "UID")

View file

@ -85,9 +85,9 @@ is true, or else the output buffer is displayed."
(set-buffer standard-output) (set-buffer standard-output)
(insert-buffer-substring pgg-errors-buffer)))) (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. "Hash table for managing scheduled pgg cache management timers.
We associate key and timer, so the timer can be canceled if a new We associate key and timer, so the timer can be canceled if a new

View file

@ -65,7 +65,7 @@
(defconst cookie-delimiter "\n%%\n\\|\n%\n\\|\0" (defconst cookie-delimiter "\n%%\n\\|\n%\n\\|\0"
"Delimiter used to separate cookie file entries.") "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.") "Cache of cookie files that have already been snarfed.")
(defun cookie-check-file (file) (defun cookie-check-file (file)

View file

@ -2425,7 +2425,7 @@ system."
(error "Unknown base mode `%s'" base-mode)) (error "Unknown base mode `%s'" base-mode))
(put mode 'c-fallback-mode 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. ;; 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 ;; 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 ;; 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. ;; Clear the evaluated values that depend on this source.
(let ((agenda (get sym 'dependents)) (let ((agenda (get sym 'dependents))
(visited (make-vector 101 0)) (visited (obarray-make 101))
ptr) ptr)
(while agenda (while agenda
(setq sym (car agenda) (setq sym (car agenda)

View 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)) (let* ((alist (c-lang-const c-keyword-member-alist))
kwd lang-const-list kwd lang-const-list
(obarray (make-vector (* (length alist) 2) 0))) (obarray (obarray-make (* (length alist) 2))))
(while alist (while alist
(setq kwd (caar alist) (setq kwd (caar alist)
lang-const-list (cdar alist) lang-const-list (cdar alist)

View 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 ;; during any subsequent VC operations, and forget them when
;; the buffer is killed. ;; 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.") "Obarray for per-file properties.")
(defvar vc-touched-properties nil) (defvar vc-touched-properties nil)

View file

@ -32,7 +32,8 @@
(should-not (obarrayp "aoeu")) (should-not (obarrayp "aoeu"))
(should-not (obarrayp '())) (should-not (obarrayp '()))
(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 () (ert-deftest obarrayp-unchecked-content-test ()
"Should fail to check content of passed obarray." "Should fail to check content of passed obarray."

View file

@ -34,7 +34,7 @@
(let ((num 0)) (let ((num 0))
(mapcar (lambda (str) (cons str (cl-incf num))) list))) (mapcar (lambda (str) (cons str (cl-incf num))) list)))
(defun minibuf-tests--strings-to-obarray (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) (mapc (lambda (str) (intern str ob)) list)
ob)) ob))
(defun minibuf-tests--strings-to-string-hashtable (list) (defun minibuf-tests--strings-to-string-hashtable (list)