From 6ec9e72bec0e9ef1405308820ed6ffa0a3841838 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Wed, 16 Nov 1994 03:41:56 +0000 Subject: (Farray_length): Delete this obsolete function. (Faref, Faset): If object is a string, use XSTRING, not XVECTOR. --- src/data.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'src/data.c') 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 */ -- cgit v1.2.1