diff options
| author | Karl Heuer | 1994-11-16 03:41:56 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-11-16 03:41:56 +0000 |
| commit | c24e4efeb5459d60d18ac82566a5f80e01466379 (patch) | |
| tree | 71f2a62df3e4b9c405cb671cd090160140eb33c3 /src/data.c | |
| parent | a2ad3e19d3aea7628b69630acea5badedf0f12f1 (diff) | |
| download | emacs-c24e4efeb5459d60d18ac82566a5f80e01466379.tar.gz emacs-c24e4efeb5459d60d18ac82566a5f80e01466379.zip | |
(Farray_length): Delete this obsolete function.
(Faref, Faset): If object is a string, use XSTRING, not XVECTOR.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 35 |
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.") | |||
| 1334 | 1334 | ||
| 1335 | CHECK_NUMBER (idx, 1); | 1335 | CHECK_NUMBER (idx, 1); |
| 1336 | idxval = XINT (idx); | 1336 | idxval = XINT (idx); |
| 1337 | if (!VECTORP (array) && !STRINGP (array) && !COMPILEDP (array)) | ||
| 1338 | array = wrong_type_argument (Qarrayp, array); | ||
| 1339 | if (idxval < 0 || idxval >= XVECTOR (array)->size) | ||
| 1340 | args_out_of_range (array, idx); | ||
| 1341 | if (STRINGP (array)) | 1337 | if (STRINGP (array)) |
| 1342 | { | 1338 | { |
| 1343 | Lisp_Object val; | 1339 | Lisp_Object val; |
| 1340 | if (idxval < 0 || idxval >= XSTRING (array)->size) | ||
| 1341 | args_out_of_range (array, idx); | ||
| 1344 | XSETFASTINT (val, (unsigned char) XSTRING (array)->data[idxval]); | 1342 | XSETFASTINT (val, (unsigned char) XSTRING (array)->data[idxval]); |
| 1345 | return val; | 1343 | return val; |
| 1346 | } | 1344 | } |
| 1347 | else | 1345 | else |
| 1348 | return XVECTOR (array)->contents[idxval]; | 1346 | { |
| 1347 | if (!VECTORP (array) && !COMPILEDP (array)) | ||
| 1348 | array = wrong_type_argument (Qarrayp, array); | ||
| 1349 | if (idxval < 0 || idxval >= XVECTOR (array)->size) | ||
| 1350 | args_out_of_range (array, idx); | ||
| 1351 | return XVECTOR (array)->contents[idxval]; | ||
| 1352 | } | ||
| 1349 | } | 1353 | } |
| 1350 | 1354 | ||
| 1351 | DEFUN ("aset", Faset, Saset, 3, 3, 0, | 1355 | DEFUN ("aset", Faset, Saset, 3, 3, 0, |
| @@ -1361,31 +1365,24 @@ ARRAY may be a vector or a string. IDX starts at 0.") | |||
| 1361 | idxval = XINT (idx); | 1365 | idxval = XINT (idx); |
| 1362 | if (!VECTORP (array) && !STRINGP (array)) | 1366 | if (!VECTORP (array) && !STRINGP (array)) |
| 1363 | array = wrong_type_argument (Qarrayp, array); | 1367 | array = wrong_type_argument (Qarrayp, array); |
| 1364 | if (idxval < 0 || idxval >= XVECTOR (array)->size) | ||
| 1365 | args_out_of_range (array, idx); | ||
| 1366 | CHECK_IMPURE (array); | 1368 | CHECK_IMPURE (array); |
| 1367 | 1369 | ||
| 1368 | if (VECTORP (array)) | 1370 | if (VECTORP (array)) |
| 1369 | XVECTOR (array)->contents[idxval] = newelt; | 1371 | { |
| 1372 | if (idxval < 0 || idxval >= XVECTOR (array)->size) | ||
| 1373 | args_out_of_range (array, idx); | ||
| 1374 | XVECTOR (array)->contents[idxval] = newelt; | ||
| 1375 | } | ||
| 1370 | else | 1376 | else |
| 1371 | { | 1377 | { |
| 1378 | if (idxval < 0 || idxval >= XSTRING (array)->size) | ||
| 1379 | args_out_of_range (array, idx); | ||
| 1372 | CHECK_NUMBER (newelt, 2); | 1380 | CHECK_NUMBER (newelt, 2); |
| 1373 | XSTRING (array)->data[idxval] = XINT (newelt); | 1381 | XSTRING (array)->data[idxval] = XINT (newelt); |
| 1374 | } | 1382 | } |
| 1375 | 1383 | ||
| 1376 | return newelt; | 1384 | return newelt; |
| 1377 | } | 1385 | } |
| 1378 | |||
| 1379 | Lisp_Object | ||
| 1380 | Farray_length (array) | ||
| 1381 | register Lisp_Object array; | ||
| 1382 | { | ||
| 1383 | register Lisp_Object size; | ||
| 1384 | if (!VECTORP (array) && !STRINGP (array) && !COMPILEDP (array)) | ||
| 1385 | array = wrong_type_argument (Qarrayp, array); | ||
| 1386 | XSETFASTINT (size, XVECTOR (array)->size); | ||
| 1387 | return size; | ||
| 1388 | } | ||
| 1389 | 1386 | ||
| 1390 | /* Arithmetic functions */ | 1387 | /* Arithmetic functions */ |
| 1391 | 1388 | ||