diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-02-10 03:20:40 +0000 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-02-10 03:20:40 +0000 |
| commit | 4b75ffab30b7764136732398319d33d7104cae68 (patch) | |
| tree | 5610831cc57e65ae1f3e4889f0f65e28a2bd1bff /src/lisp.h | |
| parent | 250962b3d8e3840c3046ae3434fc3785ecacb7eb (diff) | |
| download | emacs-4b75ffab30b7764136732398319d33d7104cae68.tar.gz | |
(ASET): Check bounds.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h index 5156386551a..daa45d3aad8 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -589,8 +589,12 @@ extern size_t pure_size; /* Convenience macros for dealing with Lisp arrays. */ #define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX] -#define ASET(ARRAY, IDX, VAL) (AREF ((ARRAY), (IDX)) = (VAL)) #define ASIZE(ARRAY) XVECTOR ((ARRAY))->size +/* The IDX==IDX tries to detect when the macro argument is side-effecting. */ +#define ASET(ARRAY, IDX, VAL) \ + (eassert ((IDX) == (IDX)), \ + eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \ + ASLOT ((ARRAY), (IDX)) = (VAL)) /* Convenience macros for dealing with Lisp strings. */ |
