From 643d393990b04de936269be1d82f631ac2dac2b6 Mon Sep 17 00:00:00 2001
From: Kenichi Handa <handa@m17n.org>
Date: Fri, 17 Jul 2009 01:26:41 +0000
Subject: [PATCH] (shuffle): Fix the logic of setting up the cycle.

---
 src/ChangeLog |  4 ++++
 src/casetab.c | 11 +++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index b517ef0c006..debe74f2bdb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-17  Kenichi Handa  <handa@m17n.org>
+
+	* casetab.c (shuffle): Fix the logic of setting up the cycle.
+
 2009-07-16  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* nsfns.m (Fns_set_alpha): Remove function.
diff --git a/src/casetab.c b/src/casetab.c
index 423251df317..95fca03584b 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -229,7 +229,6 @@ shuffle (table, c, elt)
 {
   if (NATNUMP (elt))
     {
-      Lisp_Object tem = Faref (table, elt);
       int from, to;
 
       if (CONSP (c))
@@ -241,11 +240,11 @@ shuffle (table, c, elt)
 	from = to = XINT (c);
 
       for (; from <= to; from++)
-	if (from != XINT (elt))
-	  {
-	    Faset (table, elt, make_number (from));
-	    Faset (table, make_number (from), tem);
-	  }
+	{
+	  Lisp_Object tem = Faref (table, elt);
+	  Faset (table, elt, make_number (from));
+	  Faset (table, make_number (from), tem);
+	}
     }
 }
 
-- 
2.39.5