summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-11-16 03:41:56 +0000
committerKarl Heuer <kwzh@gnu.org>1994-11-16 03:41:56 +0000
commit6ec9e72bec0e9ef1405308820ed6ffa0a3841838 (patch)
treebdd1d24a50972788b0ef9d42c2b798927b518f0a
parenta01b8464ff4d250a91dead5012f221373d0deb9a (diff)
downloademacs-6ec9e72bec0e9ef1405308820ed6ffa0a3841838.tar.gz
(Farray_length): Delete this obsolete function.
(Faref, Faset): If object is a string, use XSTRING, not XVECTOR.
-rw-r--r--src/data.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/data.c b/src/data.c
index 0350ecc3156..2f41d4ee60f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1334,18 +1334,22 @@ ARRAY may be a vector or a string, or a byte-code object. INDEX starts at 0.")
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 @@ ARRAY may be a vector or a string. IDX starts at 0.")
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 */