emacs-diffs
[Top][All Lists]
Advanced

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

master 836ef4293f 1/2: Make url-util space trimming functions obsolete


From: Stefan Kangas
Subject: master 836ef4293f 1/2: Make url-util space trimming functions obsolete
Date: Wed, 3 Aug 2022 04:40:08 -0400 (EDT)

branch: master
commit 836ef4293fa6df71336f6e88a3e404480eb2f96c
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Make url-util space trimming functions obsolete
    
    * 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 |  4 +---
 lisp/url/url-util.el | 15 ++++-----------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 3d7d877979..125f8436f6 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -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))
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index fc84d45176..993a3732ab 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -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



reply via email to

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