APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1284651987 -3600
# Node ID 2def0d83a5e3d71e94169949edcc4c8ebbcdea63
# Parent  3acaa0fc09be8f63648b7b07d7bef4b63e729829
Don't uselessly call #'nreverse, #'hash-table-key-list and friends.
2010-09-16  Aidan Kehoe  <kehoea(a)parhasard.net>
	* hash-table.el (hash-table-key-list, hash-table-value-list)
	(hash-table-key-value-alist, hash-table-key-value-plist):
	Remove some useless #'nreverse calls in these files; our hash
	tables have no order, it's not helpful to pretend they do.
	* behavior.el (read-behavior):
	Do the same in this file, in some code evidently copied from
	hash-table.el.
diff -r 3acaa0fc09be -r 2def0d83a5e3 lisp/ChangeLog
--- a/lisp/ChangeLog	Thu Sep 16 15:58:10 2010 +0100
+++ b/lisp/ChangeLog	Thu Sep 16 16:46:27 2010 +0100
@@ -1,3 +1,13 @@
+2010-09-16  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* hash-table.el (hash-table-key-list, hash-table-value-list)
+	(hash-table-key-value-alist, hash-table-key-value-plist):
+	Remove some useless #'nreverse calls in these files; our hash
+	tables have no order, it's not helpful to pretend they do.
+	* behavior.el (read-behavior):
+	Do the same in this file, in some code evidently copied from
+	hash-table.el.
+
 2010-09-16  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* info.el (Info-insert-dir):
diff -r 3acaa0fc09be -r 2def0d83a5e3 lisp/behavior.el
--- a/lisp/behavior.el	Thu Sep 16 15:58:10 2010 +0100
+++ b/lisp/behavior.el	Thu Sep 16 16:46:27 2010 +0100
@@ -349,15 +349,11 @@
   (let ((result
 	 (completing-read
 	  prompt
-	  (let ((table (let (lis)
-			 (maphash #'(lambda (key val)
-				      (push (cons key val) lis))
-				  behavior-hash-table)
-			 (nreverse lis))))
-	    (mapc #'(lambda (aentry)
-		      (setcar aentry (symbol-name (car aentry))))
-		  table)
-	    table)
+	  (let (list)
+	    (maphash #'(lambda (key value)
+			 (push (cons (symbol-name key) value) list))
+		     behavior-hash-table)
+	    list)
 	  nil must-match initial-contents (or history 'behavior-history)
 	  default-value)))
     (if (and result (stringp result))
diff -r 3acaa0fc09be -r 2def0d83a5e3 lisp/hash-table.el
--- a/lisp/hash-table.el	Thu Sep 16 15:58:10 2010 +0100
+++ b/lisp/hash-table.el	Thu Sep 16 16:46:27 2010 +0100
@@ -37,34 +37,27 @@
 
 (defun hash-table-key-list (hash-table)
   "Return a list of all keys in HASH-TABLE."
-  (let (lis)
-    (maphash #'(lambda (key val)
-		 (push key lis))
-	     hash-table)
-    (nreverse lis)))
+  (let (list)
+    (maphash #'(lambda (key value) (push key list)) hash-table)
+    list))
 
 (defun hash-table-value-list (hash-table)
   "Return a list of all values in HASH-TABLE."
-  (let (lis)
-    (maphash #'(lambda (key val)
-		 (push val lis))
-	     hash-table)
-    (nreverse lis)))
+  (let (list)
+    (maphash #'(lambda (key value) (push value list)) hash-table)
+    list))
 
 (defun hash-table-key-value-alist (hash-table)
   "Return an alist of (KEY . VALUE) for all keys and values in HASH-TABLE."
-  (let (lis)
-    (maphash #'(lambda (key val)
-		 (push (cons key val) lis))
+  (let (list)
+    (maphash #'(lambda (key value) (setq list (acons key value list)))
 	     hash-table)
-    (nreverse lis)))
+    list))
 
 (defun hash-table-key-value-plist (hash-table)
   "Return a plist for all keys and values in HASH-TABLE.
 A plist is a simple list containing alternating keys and values."
-  (let (lis)
-    (maphash #'(lambda (key val)
-		 (push key lis)
-		 (push val lis))
+  (let (list)
+    (maphash #'(lambda (key value) (setq list (list* key value list)))
 	     hash-table)
-    (nreverse lis)))
+    list))
-- 
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
  -- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/mailman/listinfo/xemacs-patches