diff src/events.c @ 3063:d30cd499e445

[xemacs-hg @ 2005-11-13 10:48:01 by ben] further error-checking, etc. alloc.c, lrecord.h: Move around the handling of setting of lheader->uid so it's in set_lheader_implementation() -- that way, even non-MC-ALLOC builds get useful uid's in their bare lrecords. Redo related code for strings so the non-ascii count that is stored in the uid isn't hosed. events.c: Save and restore the uid around event zeroing/deadbeefing. lisp.h: Set the correct value of MAX_STRING_ASCII_BEGIN under MC_ALLOC. lisp.h: rearrange the basic code handling ints and chars. basic int stuff goes first, followed by basic char stuff, followed in turn by stuff that mixes ints and chars. this is required since some basic defn's have become inline functions. XCHAR and CHARP have additional error-checking in that they check to make sure that the value in question is not just a character but a valid character (i.e. its numeric value is valid). print.c: debug_p4 now has a useful UID in all cases and uses it; but it also prints the raw header address (previously, you just got one of them). text.h: some basic char defn's that belonged in lisp.h have been moved there. valid_ichar_p() is moved too since the inline functions need it.
author ben
date Sun, 13 Nov 2005 10:48:04 +0000
parents facf3239ba30
children 141c2920ea48 3742ea8250b5
line wrap: on
line diff
--- a/src/events.c	Sun Nov 13 10:39:41 2005 +0000
+++ b/src/events.c	Sun Nov 13 10:48:04 2005 +0000
@@ -1,7 +1,7 @@
 /* Events: printing them, converting them to and from characters.
    Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
    Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
-   Copyright (C) 2001, 2002 Ben Wing.
+   Copyright (C) 2001, 2002, 2005 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -86,11 +86,14 @@
 deinitialize_event (Lisp_Object ev)
 {
   Lisp_Event *event = XEVENT (ev);
+  int i;
+  /* Preserve the old UID for this event, for tracking it */
+  unsigned int old_uid = event->lheader.uid;
 
-  int i;
   for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++)
     ((int *) event) [i] = 0xdeadbeef; /* -559038737 base 10 */
   set_lheader_implementation (&event->lheader, &lrecord_event);
+  event->lheader.uid = old_uid;
   set_event_type (event, dead_event);
   SET_EVENT_CHANNEL (event, Qnil);
   XSET_EVENT_NEXT (ev, Qnil);
@@ -100,8 +103,12 @@
 void
 zero_event (Lisp_Event *e)
 {
+  /* Preserve the old UID for this event, for tracking it */
+  unsigned int old_uid = e->lheader.uid;
+
   xzero (*e);
   set_lheader_implementation (&e->lheader, &lrecord_event);
+  e->lheader.uid = old_uid;
   set_event_type (e, empty_event);
   SET_EVENT_CHANNEL (e, Qnil);
   SET_EVENT_NEXT (e, Qnil);