diff options
| author | Paul Eggert | 2019-07-23 11:18:16 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-07-23 11:18:58 -0700 |
| commit | a48726ebae2f44ed15b97cb72bc7eca199d8de47 (patch) | |
| tree | 169d78ee718c9e8617df4de4175e0d82056f863f /src/lisp.h | |
| parent | 3479ec7332a474b3400cbc6b681c2a1f5637db94 (diff) | |
| download | emacs-a48726ebae2f44ed15b97cb72bc7eca199d8de47.tar.gz emacs-a48726ebae2f44ed15b97cb72bc7eca199d8de47.zip | |
Merge pdumper.c and alloc.c builtin symbol tests
* src/alloc.c (c_symbol_p): Move from here ...
* src/lisp.h (c_symbol_p): ... to here, and make it more portable
to hypothetical platforms where pointers are wider than ptrdiff_t.
* src/pdumper.c (dump_builtin_symbol_p): Use c_symbol_p.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lisp.h b/src/lisp.h index e96fcfe94d3..17495777378 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1024,6 +1024,20 @@ builtin_lisp_symbol (int index) | |||
| 1024 | return make_lisp_symbol (&lispsym[index]); | 1024 | return make_lisp_symbol (&lispsym[index]); |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | INLINE bool | ||
| 1028 | c_symbol_p (struct Lisp_Symbol *sym) | ||
| 1029 | { | ||
| 1030 | char *bp = (char *) lispsym; | ||
| 1031 | char *sp = (char *) sym; | ||
| 1032 | if (PTRDIFF_MAX < INTPTR_MAX) | ||
| 1033 | return bp <= sp && sp < bp + sizeof lispsym; | ||
| 1034 | else | ||
| 1035 | { | ||
| 1036 | ptrdiff_t offset = sp - bp; | ||
| 1037 | return 0 <= offset && offset < sizeof lispsym; | ||
| 1038 | } | ||
| 1039 | } | ||
| 1040 | |||
| 1027 | INLINE void | 1041 | INLINE void |
| 1028 | (CHECK_SYMBOL) (Lisp_Object x) | 1042 | (CHECK_SYMBOL) (Lisp_Object x) |
| 1029 | { | 1043 | { |