diff options
author | Mark Oteiza <mvoteiza@udel.edu> | 2017-02-18 20:25:50 -0500 |
---|---|---|
committer | Mark Oteiza <mvoteiza@udel.edu> | 2017-02-18 20:25:50 -0500 |
commit | 7f89c208bf4bb256c67cc59351f4171c7a6b63aa (patch) | |
tree | 79514b61a1b6041cb0b10998d5ffc2bca3012bba /lisp/json.el | |
parent | 861ff2ba2cfc19065b13bf9b9670b44e1496c64e (diff) | |
download | emacs-7f89c208bf4bb256c67cc59351f4171c7a6b63aa.tar.gz |
More json.el changes
* lisp/json.el (json-read-keyword, json-read-number, json-read-object):
(json-read-array): Just use = for char comparison.
Diffstat (limited to 'lisp/json.el')
-rw-r--r-- | lisp/json.el | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/json.el b/lisp/json.el index 59942dbed8f..049c9b1951a 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 "]" |