unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] some misuse of GCPROs
@ 2011-11-18 14:06 Dmitry Antipov
  2011-11-18 16:51 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Antipov @ 2011-11-18 14:06 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]

...found while hacking around GC_MARK_STACK with DEBUG_GCPRO.

Dmitry

[-- Attachment #2: gcpro_fixes.patch --]
[-- Type: text/plain, Size: 1992 bytes --]

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-11-18 12:41:36 +0000
+++ src/ChangeLog	2011-11-18 14:02:15 +0000
@@ -1,3 +1,9 @@
+2011-11-18  Dmitry Antipov  <dmantipov@yandex.ru>
+
+	* keymap.c (Fwhere_is_internal): Add missing RETURN_UNGCPROs.
+
+	* fileio.c (Finsert_file_contents): Use inner_gcpro.
+
 2011-11-18  Eli Zaretskii  <eliz@gnu.org>
 
 	* dispnew.c (swap_glyph_pointers): Swap the used[] arrays and the

=== modified file 'src/fileio.c'
--- src/fileio.c	2011-09-30 20:22:01 +0000
+++ src/fileio.c	2011-11-18 13:58:04 +0000
@@ -3686,6 +3686,7 @@
       int this_count = SPECPDL_INDEX ();
       int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
       Lisp_Object conversion_buffer;
+      struct gcpro inner_gcpro1;
 
       conversion_buffer = code_conversion_save (1, multibyte);
 
@@ -3701,7 +3702,7 @@
       inserted = 0;		/* Bytes put into CONVERSION_BUFFER so far.  */
       unprocessed = 0;		/* Bytes not processed in previous loop.  */
 
-      GCPRO1 (conversion_buffer);
+      GCPRO1_VAR (conversion_buffer, inner_gcpro);
       while (how_much < total)
 	{
 	  /* We read one bunch by one (READ_BUF_SIZE bytes) to allow
@@ -3729,7 +3730,7 @@
 	  if (coding.carryover_bytes > 0)
 	    memcpy (read_buf, coding.carryover, unprocessed);
 	}
-      UNGCPRO;
+      UNGCPRO_VAR (inner_gcpro);
       emacs_close (fd);
 
       /* We should remove the unwind_protect calling

=== modified file 'src/keymap.c'
--- src/keymap.c	2011-11-17 17:40:48 +0000
+++ src/keymap.c	2011-11-18 13:50:01 +0000
@@ -2624,11 +2624,11 @@
       /* We have a list of advertised bindings.  */
       while (CONSP (tem))
 	if (EQ (shadow_lookup (keymaps, XCAR (tem), Qnil, 0), definition))
-	  return XCAR (tem);
+	  RETURN_UNGCPRO (XCAR (tem));
 	else
 	  tem = XCDR (tem);
       if (EQ (shadow_lookup (keymaps, tem, Qnil, 0), definition))
-	return tem;
+	RETURN_UNGCPRO (tem);
     }
 
   sequences = Freverse (where_is_internal (definition, keymaps,


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-20  4:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-18 14:06 [PATCH] some misuse of GCPROs Dmitry Antipov
2011-11-18 16:51 ` Stefan Monnier
2011-11-18 17:24   ` Dmitry Antipov
2011-11-20  4:35     ` Stefan Monnier
2011-11-18 19:04   ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).