[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 418400a: Simplify XPNTR
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 418400a: Simplify XPNTR |
Date: |
Mon, 22 Apr 2019 00:45:42 -0400 (EDT) |
branch: master
commit 418400ab7b36d873905f5ab5e1e07f2bdbd05f9c
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Simplify XPNTR
Because XPNTR now uses ATTRIBUTE_NO_SANITIZE_UNDEFINED,
it can be simplified.
* src/alloc.c (macro_PNTR_ADD, PNTR_ADD, macro_XPNTR): Remove.
(XPNTR): Open-code rather than using the removed macros and
functions. Also, simplify by using LISP_WORD_TAG.
---
src/alloc.c | 32 +++-----------------------------
1 file changed, 3 insertions(+), 29 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index a9cdd77..186a4c6 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -528,40 +528,14 @@ pointer_align (void *ptr, int alignment)
return (void *) ROUNDUP ((uintptr_t) ptr, alignment);
}
-/* Define PNTR_ADD and XPNTR as functions, which are cleaner and can
- be used in debuggers. Also, define them as macros if
- DEFINE_KEY_OPS_AS_MACROS, for performance in that case.
- The macro_* macros are private to this section of code. */
-
-/* Add a pointer P to an integer I without gcc -fsanitize complaining
- about the result being out of range of the underlying array. */
-
-#define macro_PNTR_ADD(p, i) ((p) + (i))
-
-static ATTRIBUTE_NO_SANITIZE_UNDEFINED ATTRIBUTE_UNUSED char *
-PNTR_ADD (char *p, EMACS_UINT i)
-{
- return macro_PNTR_ADD (p, i);
-}
-
-#if DEFINE_KEY_OPS_AS_MACROS
-# define PNTR_ADD(p, i) macro_PNTR_ADD (p, i)
-#endif
-
/* Extract the pointer hidden within O. */
-#define macro_XPNTR(o) \
- ((void *) \
- (SYMBOLP (o) \
- ? PNTR_ADD ((char *) lispsym, \
- (XLI (o) \
- - ((EMACS_UINT) Lisp_Symbol << (USE_LSB_TAG ? 0 : VALBITS)))) \
- : (char *) XLP (o) - (XLI (o) & ~VALMASK)))
-
static ATTRIBUTE_NO_SANITIZE_UNDEFINED void *
XPNTR (Lisp_Object a)
{
- return macro_XPNTR (a);
+ return (SYMBOLP (a)
+ ? (char *) lispsym + (XLI (a) - LISP_WORD_TAG (Lisp_Symbol))
+ : (char *) XLP (a) - (XLI (a) & ~VALMASK));
}
static void
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 418400a: Simplify XPNTR,
Paul Eggert <=