all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: emacs-devel@gnu.org
Subject: [PATCH] some misuse of GCPROs
Date: Fri, 18 Nov 2011 18:06:54 +0400	[thread overview]
Message-ID: <4EC6667E.3040008@yandex.ru> (raw)

[-- 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,


             reply	other threads:[~2011-11-18 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 14:06 Dmitry Antipov [this message]
2011-11-18 16:51 ` [PATCH] some misuse of GCPROs Stefan Monnier
2011-11-18 17:24   ` Dmitry Antipov
2011-11-20  4:35     ` Stefan Monnier
2011-11-18 19:04   ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EC6667E.3040008@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.