Original patch here:
http://www.sxemacs.org/list-archives/html/sxemacs-patches/2007-01/msg0000...
This varies quite a bit from that patch, since the 21.5 code is
significantly different.
src/ChangeLog addition:
2007-05-24 Aidan Kehoe <kehoea(a)parhasard.net>
* free-hook.c (check_free):
* lisp.h:
* lisp.h (xfree):
Inspired by some of Sebastian Freundt's SXEmacs work, use a 64-bit
constant on 64-bit platforms when making sure pointers haven't
been freed twice.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: src/lisp.h
===================================================================
RCS src/free-hook.c
===================================================================
RCS
Index: src/free-hook.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/free-hook.c,v
retrieving revision 1.13
diff -u -u -r1.13 free-hook.c
--- src/free-hook.c 2005/01/26 10:36:08 1.13
+++ src/free-hook.c 2007/05/24 07:35:03
@@ -179,6 +179,8 @@
/ sizeof (long);
unsigned long i;
+ /* Not using the DEADBEEF_CONSTANT #define, since we don't know
+ * that allocation sizes will be multiples of eight. */
for (i = 0; i < long_length; i++)
((unsigned long *) ptr)[i] = 0xdeadbeef;
}
Index: src/lisp.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lisp.h,v
retrieving revision 1.144
diff -u -u -r1.144 lisp.h
--- src/lisp.h 2006/11/05 22:31:44 1.144
+++ src/lisp.h 2007/05/24 07:35:05
@@ -250,6 +250,14 @@
typedef unsigned long uintptr_t;
#endif
+#if SIZEOF_VOID_P == 8
+#define DEADBEEF_CONSTANT 0xCAFEBABEDEADBEEF
+#elif SIZEOF_VOID_P == 4
+#define DEADBEEF_CONSTANT 0xDEADBEEF
+#else
+#error "What size are your pointers, really?"
+#endif /* SIZEOF_VOID_P == 8 */
+
/* ---------------------- definition of EMACS_INT --------------------- */
/* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
@@ -1084,7 +1092,7 @@
#define xfree(lvalue, type) do \
{ \
xfree_1 (lvalue); \
- VOIDP_CAST (lvalue) = (void *) 0xDEADBEEF; \
+ VOIDP_CAST (lvalue) = (void *) DEADBEEF_CONSTANT; \
} while (0)
#else
#define xfree(lvalue,type) xfree_1 (lvalue)
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches