]> git.eshelyaron.com Git - emacs.git/commitdiff
Make url-util space trimming functions obsolete
authorStefan Kangas <stefan@marxist.se>
Wed, 3 Aug 2022 08:00:34 +0000 (10:00 +0200)
committerStefan Kangas <stefan@marxist.se>
Wed, 3 Aug 2022 08:39:47 +0000 (10:39 +0200)
* lisp/url/url-util.el (url-eat-trailing-space)
(url-strip-leading-spaces): Make obsolete in favor of
'string-trim'.  Update caller.

lisp/url/url-http.el
lisp/url/url-util.el

index 3d7d8779795dd1e91516c17ec9dea00e431a6884..125f8436f68b697b32834df0e91093d46c30a511 100644 (file)
@@ -471,9 +471,7 @@ Return the number of characters removed."
           t ;; Instruct caller to signal an error.  Bug#50511
         ;; Find strongest supported auth.
         (dolist (this-auth auths)
-          (setq this-auth (url-eat-trailing-space
-                           (url-strip-leading-spaces
-                            this-auth)))
+          (setq this-auth (string-trim this-auth))
           (let* ((this-type
                   (downcase (if (string-match "[ \t]" this-auth)
                                 (substring this-auth 0 (match-beginning 0))
index fc84d45176036f0174e4041623fb9de3266b35bf..993a3732abf9d5bc98aa7e391a4d771ecaecea41 100644 (file)
@@ -182,21 +182,14 @@ Will not do anything if `url-show-status' is nil."
 ;;;###autoload
 (defun url-eat-trailing-space (x)
   "Remove spaces/tabs at the end of a string."
-  (let ((y (1- (length x)))
-       (skip-chars (list ?  ?\t ?\n)))
-    (while (and (>= y 0) (memq (aref x y) skip-chars))
-      (setq y (1- y)))
-    (substring x 0 (1+ y))))
+  (declare (obsolete string-trim "29.1"))
+  (string-trim x ""))
 
 ;;;###autoload
 (defun url-strip-leading-spaces (x)
   "Remove spaces at the front of a string."
-  (let ((y (1- (length x)))
-       (z 0)
-       (skip-chars (list ?  ?\t ?\n)))
-    (while (and (<= z y) (memq (aref x z) skip-chars))
-      (setq z (1+ z)))
-    (substring x z nil)))
+  (declare (obsolete string-trim "29.1"))
+  (string-trim x nil ""))
 
 
 (define-obsolete-function-alias 'url-pretty-length