]> git.eshelyaron.com Git - emacs.git/commitdiff
More json.el changes
authorMark Oteiza <mvoteiza@udel.edu>
Sun, 19 Feb 2017 01:25:50 +0000 (20:25 -0500)
committerMark Oteiza <mvoteiza@udel.edu>
Sun, 19 Feb 2017 01:25:50 +0000 (20:25 -0500)
* lisp/json.el (json-read-keyword, json-read-number, json-read-object):
(json-read-array): Just use = for char comparison.

lisp/json.el

index 59942dbed8f880dec91a910ebe37581ab9b0f4e2..049c9b1951addd502c17e0f367d4add833243a27 100644 (file)
@@ -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 "]"