emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 7f89c20: More json.el changes


From: Mark Oteiza
Subject: [Emacs-diffs] master 7f89c20: More json.el changes
Date: Sat, 18 Feb 2017 20:26:55 -0500 (EST)

branch: master
commit 7f89c208bf4bb256c67cc59351f4171c7a6b63aa
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    More json.el changes
    
    * lisp/json.el (json-read-keyword, json-read-number, json-read-object):
    (json-read-array): Just use = for char comparison.
---
 lisp/json.el | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/json.el b/lisp/json.el
index 59942db..049c9b1 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -293,7 +293,7 @@ KEYWORD is the keyword expected."
   (unless (member keyword json-keywords)
     (signal 'json-unknown-keyword (list keyword)))
   (mapc (lambda (char)
-          (unless (char-equal char (json-peek))
+          (when (/= char (json-peek))
             (signal 'json-unknown-keyword
                     (list (save-excursion
                             (backward-word-strictly 1)
@@ -330,10 +330,10 @@ representation will be parsed correctly."
  ;; If SIGN is non-nil, the number is explicitly signed.
  (let ((number-regexp
         "\\([0-9]+\\)?\\(\\.[0-9]+\\)?\\([Ee][+-]?[0-9]+\\)?"))
-   (cond ((and (null sign) (char-equal (json-peek) ?-))
+   (cond ((and (null sign) (= (json-peek) ?-))
           (json-advance)
           (- (json-read-number t)))
-         ((and (null sign) (char-equal (json-peek) ?+))
+         ((and (null sign) (= (json-peek) ?+))
           (json-advance)
           (json-read-number t))
          ((and (looking-at number-regexp)
@@ -495,11 +495,11 @@ Please see the documentation of `json-object-type' and 
`json-key-type'."
   ;; read key/value pairs until "}"
   (let ((elements (json-new-object))
         key value)
-    (while (not (char-equal (json-peek) ?}))
+    (while (not (= (json-peek) ?}))
       (json-skip-whitespace)
       (setq key (json-read-string))
       (json-skip-whitespace)
-      (if (char-equal (json-peek) ?:)
+      (if (= (json-peek) ?:)
           (json-advance)
         (signal 'json-object-format (list ":" (json-peek))))
       (json-skip-whitespace)
@@ -510,8 +510,8 @@ Please see the documentation of `json-object-type' and 
`json-key-type'."
         (funcall json-post-element-read-function))
       (setq elements (json-add-to-object elements key value))
       (json-skip-whitespace)
-      (unless (char-equal (json-peek) ?})
-        (if (char-equal (json-peek) ?,)
+      (when (/= (json-peek) ?})
+        (if (= (json-peek) ?,)
             (json-advance)
           (signal 'json-object-format (list "," (json-peek))))))
     ;; Skip over the "}"
@@ -621,7 +621,7 @@ become JSON objects."
   (json-skip-whitespace)
   ;; read values until "]"
   (let (elements)
-    (while (not (char-equal (json-peek) ?\]))
+    (while (not (= (json-peek) ?\]))
       (json-skip-whitespace)
       (when json-pre-element-read-function
         (funcall json-pre-element-read-function (length elements)))
@@ -629,8 +629,8 @@ become JSON objects."
       (when json-post-element-read-function
         (funcall json-post-element-read-function))
       (json-skip-whitespace)
-      (unless (char-equal (json-peek) ?\])
-        (if (char-equal (json-peek) ?,)
+      (when (/= (json-peek) ?\])
+        (if (= (json-peek) ?,)
             (json-advance)
           (signal 'json-error (list 'bleah)))))
     ;; Skip over the "]"



reply via email to

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