diff options
| author | Dmitry Antipov | 2013-01-15 13:22:25 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-01-15 13:22:25 +0400 |
| commit | 2b30549c493d7b67fa92c2b4bcd2bd2e55210ae1 (patch) | |
| tree | ac4cc77344b3285eb47d5145eb0b28dd6034f54d /src/lisp.h | |
| parent | 1b971ac155006504b6b1c2688199747f976723af (diff) | |
| download | emacs-2b30549c493d7b67fa92c2b4bcd2bd2e55210ae1.tar.gz emacs-2b30549c493d7b67fa92c2b4bcd2bd2e55210ae1.zip | |
* src/lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow extraction
from any Lisp_Save_Value slot. Add type checking.
* src/alloc.c, src/dired.c, src/editfns.c, src/fileio.c, src/ftfont.c:
* src/gtkutil.c, src/keymap.c, src/lread.c, src/nsterm.h, src/nsmenu.c:
* src/xfns.c, src/xmenu.c, src/xselect.c: All users changed.
* admin/coccinelle/xsave.cocci: Semantic patch to adjust users of
XSAVE_POINTER and XSAVE_INTEGER macros.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lisp.h b/src/lisp.h index ac7346c5386..1ff8f83270b 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1413,15 +1413,21 @@ struct Lisp_Save_Value | |||
| 1413 | } data[4]; | 1413 | } data[4]; |
| 1414 | }; | 1414 | }; |
| 1415 | 1415 | ||
| 1416 | /* Compatibility macro to set and extract saved pointer. */ | 1416 | /* Macro to set and extract Nth saved pointer. Type |
| 1417 | checking is ugly because it's used as an lvalue. */ | ||
| 1417 | 1418 | ||
| 1418 | #define XSAVE_POINTER(obj) XSAVE_VALUE (obj)->data[0].pointer | 1419 | #define XSAVE_POINTER(obj, n) \ |
| 1420 | XSAVE_VALUE (obj)->data[(eassert (XSAVE_VALUE (obj)->type \ | ||
| 1421 | ## n == SAVE_POINTER), n)].pointer | ||
| 1419 | 1422 | ||
| 1420 | /* Likewise for the saved integer. */ | 1423 | /* Likewise for the saved integer. */ |
| 1421 | 1424 | ||
| 1422 | #define XSAVE_INTEGER(obj) XSAVE_VALUE (obj)->data[1].integer | 1425 | #define XSAVE_INTEGER(obj, n) \ |
| 1426 | XSAVE_VALUE (obj)->data[(eassert (XSAVE_VALUE (obj)->type \ | ||
| 1427 | ## n == SAVE_INTEGER), n)].integer | ||
| 1423 | 1428 | ||
| 1424 | /* Macro to extract Nth saved object. */ | 1429 | /* Macro to extract Nth saved object. This is never used as |
| 1430 | an lvalue, so we can do more convenient type checking. */ | ||
| 1425 | 1431 | ||
| 1426 | #define XSAVE_OBJECT(obj, n) \ | 1432 | #define XSAVE_OBJECT(obj, n) \ |
| 1427 | (eassert (XSAVE_VALUE (obj)->type ## n == SAVE_OBJECT), \ | 1433 | (eassert (XSAVE_VALUE (obj)->type ## n == SAVE_OBJECT), \ |