changeset 9966:d64bdd958254

(Farray_length): Delete this obsolete function. (Faref, Faset): If object is a string, use XSTRING, not XVECTOR.
author Karl Heuer <kwzh@gnu.org>
date Wed, 16 Nov 1994 03:41:56 +0000
parents f68eab303ddb
children 620611070d29
files src/data.c
diffstat 1 files changed, 16 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/data.c	Wed Nov 16 03:37:56 1994 +0000
+++ b/src/data.c	Wed Nov 16 03:41:56 1994 +0000
@@ -1334,18 +1334,22 @@
 
   CHECK_NUMBER (idx, 1);
   idxval = XINT (idx);
-  if (!VECTORP (array) && !STRINGP (array) && !COMPILEDP (array))
-    array = wrong_type_argument (Qarrayp, array);
-  if (idxval < 0 || idxval >= XVECTOR (array)->size)
-    args_out_of_range (array, idx);
   if (STRINGP (array))
     {
       Lisp_Object val;
+      if (idxval < 0 || idxval >= XSTRING (array)->size)
+	args_out_of_range (array, idx);
       XSETFASTINT (val, (unsigned char) XSTRING (array)->data[idxval]);
       return val;
     }
   else
-    return XVECTOR (array)->contents[idxval];
+    {
+      if (!VECTORP (array) && !COMPILEDP (array))
+	array = wrong_type_argument (Qarrayp, array);
+      if (idxval < 0 || idxval >= XVECTOR (array)->size)
+	args_out_of_range (array, idx);
+      return XVECTOR (array)->contents[idxval];
+    }
 }
 
 DEFUN ("aset", Faset, Saset, 3, 3, 0,
@@ -1361,31 +1365,24 @@
   idxval = XINT (idx);
   if (!VECTORP (array) && !STRINGP (array))
     array = wrong_type_argument (Qarrayp, array);
-  if (idxval < 0 || idxval >= XVECTOR (array)->size)
-    args_out_of_range (array, idx);
   CHECK_IMPURE (array);
 
   if (VECTORP (array))
-    XVECTOR (array)->contents[idxval] = newelt;
+    {
+      if (idxval < 0 || idxval >= XVECTOR (array)->size)
+	args_out_of_range (array, idx);
+      XVECTOR (array)->contents[idxval] = newelt;
+    }
   else
     {
+      if (idxval < 0 || idxval >= XSTRING (array)->size)
+	args_out_of_range (array, idx);
       CHECK_NUMBER (newelt, 2);
       XSTRING (array)->data[idxval] = XINT (newelt);
     }
 
   return newelt;
 }
-
-Lisp_Object
-Farray_length (array)
-     register Lisp_Object array;
-{
-  register Lisp_Object size;
-  if (!VECTORP (array) && !STRINGP (array) && !COMPILEDP (array))
-    array = wrong_type_argument (Qarrayp, array);
-  XSETFASTINT (size, XVECTOR (array)->size);
-  return size;
-}
 
 /* Arithmetic functions */