changeset 51577:f624d43a48fb

(mark_kboards): New fun, moved from alloc.c. Mark kbd_buffer. (record_asynch_buffer_change, read_avail_input): Don't pass uninitialized data to kbd_buffer_store_event.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 15 Jun 2003 21:46:53 +0000
parents df2c9d815bb3
children 42f25a716cb8
files src/keyboard.c
diffstat 1 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sun Jun 15 21:20:55 2003 +0000
+++ b/src/keyboard.c	Sun Jun 15 21:46:53 2003 +0000
@@ -6627,6 +6627,7 @@
 {
   struct input_event event;
   Lisp_Object tem;
+  EVENT_INIT (event);
 
   event.kind = BUFFER_SWITCH_EVENT;
   event.frame_or_window = Qnil;
@@ -6685,6 +6686,9 @@
   register int i;
   int nread;
 
+  for (i = 0; i < KBD_BUFFER_SIZE; i++)
+    EVENT_INIT (buf[i]);
+
   if (read_socket_hook)
     /* No need for FIONREAD or fcntl; just say don't wait.  */
     nread = (*read_socket_hook) (input_fd, buf, KBD_BUFFER_SIZE, expected);
@@ -11376,3 +11380,42 @@
   initial_define_lispy_key (Vspecial_event_map, "save-session",
 			    "handle-save-session");
 }
+
+/* Mark the pointers in the kboard objects.
+   Called by the Fgarbage_collector.  */
+void
+mark_kboards ()
+{
+  KBOARD *kb;
+  Lisp_Object *p;
+  for (kb = all_kboards; kb; kb = kb->next_kboard)
+    {
+      if (kb->kbd_macro_buffer)
+	for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++)
+	  mark_object (p);
+      mark_object (&kb->Voverriding_terminal_local_map);
+      mark_object (&kb->Vlast_command);
+      mark_object (&kb->Vreal_last_command);
+      mark_object (&kb->Vprefix_arg);
+      mark_object (&kb->Vlast_prefix_arg);
+      mark_object (&kb->kbd_queue);
+      mark_object (&kb->defining_kbd_macro);
+      mark_object (&kb->Vlast_kbd_macro);
+      mark_object (&kb->Vsystem_key_alist);
+      mark_object (&kb->system_key_syms);
+      mark_object (&kb->Vdefault_minibuffer_frame);
+      mark_object (&kb->echo_string);
+    }
+  {
+    struct input_event *event;
+    for (event = kbd_fetch_ptr; event != kbd_store_ptr; event++)
+      {
+	if (event == kbd_buffer + KBD_BUFFER_SIZE)
+	  event = kbd_buffer;
+	mark_object (&event->x);
+	mark_object (&event->y);
+	mark_object (&event->frame_or_window);
+	mark_object (&event->arg);
+      }
+  }
+}