emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] some misuse of GCPROs


From: Dmitry Antipov
Subject: Re: [PATCH] some misuse of GCPROs
Date: Fri, 18 Nov 2011 21:24:45 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0

On 11/18/2011 08:51 PM, Stefan Monnier wrote:

I really dislike this inner_gcpro business, so I haven't installed
this hunk.  What is it needed for?

I too, but this is a fix for 'reuse GCPRO' error. The following code

...
Lisp_Object foo;
struct gcpro gcpro1;
...
GCPRO1 (foo);
...
if (...)
  {
     Lisp_Object bar;
     ...
     GCPRO1 (bar);
     ...
     UNGCPRO;
  }
....

is wrong because it clears the protection of 'foo' by re-using
'gcpro1' to protect 'bar'.

It should be:

...
Lisp_Object foo;
struct gcpro gcpro1;
...
GCPRO1 (foo);
...
if (...)
  {
     Lisp_Object bar;
     struct gcpro inner_gcpro1;
     ...
     GCPRO1_VAR (bar, inner_gcpro);
     ...
     UNGCPRO_VAR (inner_gcpro);
  }
....

Dmitry



reply via email to

[Prev in Thread] Current Thread [Next in Thread]