changeset 18035:edf54f605b36

(Fchar_table_range, Fset_char_table_range): Make one-element vector work for RANGE.
author Richard M. Stallman <rms@gnu.org>
date Fri, 30 May 1997 05:11:26 +0000
parents 0d96c759902b
children d6297be18ba8
files src/fns.c
diffstat 1 files changed, 22 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Fri May 30 00:58:54 1997 +0000
+++ b/src/fns.c	Fri May 30 05:11:26 1997 +0000
@@ -1315,12 +1315,17 @@
     return Faref (char_table, range);
   else if (VECTORP (range))
     {
-      int size = XVECTOR (range)->size;
-      Lisp_Object *val = XVECTOR (range)->contents;
-      Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0],
-					    size <= 1 ? Qnil : val[1],
-					    size <= 2 ? Qnil : val[2]);
-      return Faref (char_table, ch);
+      if (XVECTOR (range)->size == 1)
+	return Faref (char_table, XVECTOR (range)->contents[0]);
+      else
+	{
+	  int size = XVECTOR (range)->size;
+	  Lisp_Object *val = XVECTOR (range)->contents;
+	  Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0],
+						size <= 1 ? Qnil : val[1],
+						size <= 2 ? Qnil : val[2]);
+	  return Faref (char_table, ch);
+	}
     }
   else
     error ("Invalid RANGE argument to `char-table-range'");
@@ -1348,12 +1353,17 @@
     Faset (char_table, range, value);
   else if (VECTORP (range))
     {
-      int size = XVECTOR (range)->size;
-      Lisp_Object *val = XVECTOR (range)->contents;
-      Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0],
-					    size <= 1 ? Qnil : val[1],
-					    size <= 2 ? Qnil : val[2]);
-      return Faset (char_table, ch, value);
+      if (XVECTOR (range)->size == 1)
+	return Faset (char_table, XVECTOR (range)->contents[0], value);
+      else
+	{
+	  int size = XVECTOR (range)->size;
+	  Lisp_Object *val = XVECTOR (range)->contents;
+	  Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0],
+						size <= 1 ? Qnil : val[1],
+						size <= 2 ? Qnil : val[2]);
+	  return Faset (char_table, ch, value);
+	}
     }
   else
     error ("Invalid RANGE argument to `set-char-table-range'");