summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2022-07-28 12:35:21 -0400
committerSam Steingold <sds@gnu.org>2022-07-28 12:36:21 -0400
commiteeeb481750b5cec264af0f4ea5298cae011e5050 (patch)
treefa0a52ecceda4e14d10f714a3ec1a57982805a98
parent6023b95948e85f44d827e0066832de145737aea7 (diff)
downloademacs-eeeb481750b5cec264af0f4ea5298cae011e5050.tar.gz
emacs-eeeb481750b5cec264af0f4ea5298cae011e5050.tar.bz2
emacs-eeeb481750b5cec264af0f4ea5298cae011e5050.zip
Cleanup `string-equal-ignore-case' declarations.
Also, a minor declaration cleanup for other `compare-strings' thin wrappers. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove `string-equal-ignore-case', `string-prefix-p', `string-suffix-p'. (side-effect-and-error-free-fns): Add `proper-list-p' (it already was in `pure-fns'). (pure-fns): Remove `string-prefix-p', `string-suffix-p' (`string-equal-ignore-case' was missing here). * lisp/subr.el (proper-list-p): Remove partially duplicate `put's from here. (string-equal-ignore-case, string-prefix-p, string-suffix-p): Add `pure' and `side-effect-free' declarations. (string-equal-ignore-case): Make inline.
-rw-r--r--lisp/emacs-lisp/byte-opt.el7
-rw-r--r--lisp/subr.el10
2 files changed, 7 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 3f4af44051c..9817fa0eb15 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1451,8 +1451,7 @@ See Info node `(elisp) Integer Basics'."
radians-to-degrees rassq rassoc read-from-string regexp-opt
regexp-quote region-beginning region-end reverse round
sin sqrt string string< string= string-equal string-lessp
- string> string-greaterp string-empty-p string-equal-ignore-case
- string-prefix-p string-suffix-p string-blank-p
+ string> string-greaterp string-empty-p string-blank-p
string-search string-to-char
string-to-number string-to-syntax substring
sxhash sxhash-equal sxhash-eq sxhash-eql
@@ -1500,7 +1499,7 @@ See Info node `(elisp) Integer Basics'."
natnump nlistp not null number-or-marker-p numberp
one-window-p overlayp
point point-marker point-min point-max preceding-char primary-charset
- processp
+ processp proper-list-p
recent-keys recursion-depth
safe-length selected-frame selected-window sequencep
standard-case-table standard-syntax-table stringp subrp symbolp
@@ -1545,7 +1544,7 @@ See Info node `(elisp) Integer Basics'."
floor ceiling round truncate
ffloor fceiling fround ftruncate
string= string-equal string< string-lessp string> string-greaterp
- string-empty-p string-blank-p string-prefix-p string-suffix-p
+ string-empty-p string-blank-p
string-search
consp atom listp nlistp proper-list-p
sequencep arrayp vectorp stringp bool-vector-p hash-table-p
diff --git a/lisp/subr.el b/lisp/subr.el
index c82b33bba53..6b121a314a9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -733,11 +733,6 @@ If N is omitted or nil, remove the last element."
(if (> n 0) (setcdr (nthcdr (- (1- m) n) list) nil))
list))))
-;; The function's definition was moved to fns.c,
-;; but it's easier to set properties here.
-(put 'proper-list-p 'pure t)
-(put 'proper-list-p 'side-effect-free 'error-free)
-
(defun delete-dups (list)
"Destructively remove `equal' duplicates from LIST.
Store the result in LIST and return it. LIST must be a proper list.
@@ -5302,16 +5297,18 @@ and replace a sub-expression, e.g.
(setq matches (cons (substring string start l) matches)) ; leftover
(apply #'concat (nreverse matches)))))
-(defun string-equal-ignore-case (string1 string2)
+(defsubst string-equal-ignore-case (string1 string2)
"Like `string-equal', but case-insensitive.
Upper-case and lower-case letters are treated as equal.
Unibyte strings are converted to multibyte for comparison."
+ (declare (pure t) (side-effect-free t))
(eq t (compare-strings string1 0 nil string2 0 nil t)))
(defun string-prefix-p (prefix string &optional ignore-case)
"Return non-nil if PREFIX is a prefix of STRING.
If IGNORE-CASE is non-nil, the comparison is done without paying attention
to case differences."
+ (declare (pure t) (side-effect-free t))
(let ((prefix-length (length prefix)))
(if (> prefix-length (length string)) nil
(eq t (compare-strings prefix 0 prefix-length string
@@ -5321,6 +5318,7 @@ to case differences."
"Return non-nil if SUFFIX is a suffix of STRING.
If IGNORE-CASE is non-nil, the comparison is done without paying
attention to case differences."
+ (declare (pure t) (side-effect-free t))
(let ((start-pos (- (length string) (length suffix))))
(and (>= start-pos 0)
(eq t (compare-strings suffix nil nil