diff options
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/json.el | 21 |
2 files changed, 18 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e3daabae644..8034cebf0e5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-10-17 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * json.el: Bump version to 1.3 and note change in History. | ||
| 4 | (json-alist-p, json-plist-p): Rewrite to avoid recursion. | ||
| 5 | |||
| 1 | 2011-10-17 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2011-10-17 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * comint.el (comint-insert-input, comint-send-input) | 8 | * comint.el (comint-insert-input, comint-send-input) |
diff --git a/lisp/json.el b/lisp/json.el index 47448f4702a..33e985abbee 100644 --- a/lisp/json.el +++ b/lisp/json.el | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | ;; Copyright (C) 2006-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2006-2011 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Edward O'Connor <ted@oconnor.cx> | 5 | ;; Author: Edward O'Connor <ted@oconnor.cx> |
| 6 | ;; Version: 1.2 | 6 | ;; Version: 1.3 |
| 7 | ;; Keywords: convenience | 7 | ;; Keywords: convenience |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| @@ -47,6 +47,7 @@ | |||
| 47 | ;; other cleanups, bugfixes, and improvements. | 47 | ;; other cleanups, bugfixes, and improvements. |
| 48 | ;; 2006-12-29 - XEmacs support, from Aidan Kehoe <kehoea@parhasard.net>. | 48 | ;; 2006-12-29 - XEmacs support, from Aidan Kehoe <kehoea@parhasard.net>. |
| 49 | ;; 2008-02-21 - Installed in GNU Emacs. | 49 | ;; 2008-02-21 - Installed in GNU Emacs. |
| 50 | ;; 2011-10-17 - Patch `json-alist-p' and `json-plist-p' to avoid recursion -tzz | ||
| 50 | 51 | ||
| 51 | ;;; Code: | 52 | ;;; Code: |
| 52 | 53 | ||
| @@ -108,16 +109,20 @@ this around your call to `json-read' instead of `setq'ing it.") | |||
| 108 | 109 | ||
| 109 | (defun json-alist-p (list) | 110 | (defun json-alist-p (list) |
| 110 | "Non-null if and only if LIST is an alist." | 111 | "Non-null if and only if LIST is an alist." |
| 111 | (or (null list) | 112 | (while (consp list) |
| 112 | (and (consp (car list)) | 113 | (setq list (if (consp (car list)) |
| 113 | (json-alist-p (cdr list))))) | 114 | (cdr list) |
| 115 | 'not-alist))) | ||
| 116 | (null list)) | ||
| 114 | 117 | ||
| 115 | (defun json-plist-p (list) | 118 | (defun json-plist-p (list) |
| 116 | "Non-null if and only if LIST is a plist." | 119 | "Non-null if and only if LIST is a plist." |
| 117 | (or (null list) | 120 | (while (consp list) |
| 118 | (and (keywordp (car list)) | 121 | (setq list (if (and (keywordp (car list)) |
| 119 | (consp (cdr list)) | 122 | (consp (cdr list))) |
| 120 | (json-plist-p (cddr list))))) | 123 | (cddr list) |
| 124 | 'not-plist))) | ||
| 125 | (null list)) | ||
| 121 | 126 | ||
| 122 | ;; Reader utilities | 127 | ;; Reader utilities |
| 123 | 128 | ||