Matt Tucker <tuck(a)whistlingfish.net> writes:
-- Martin Buchholz <martin(a)xemacs.org> spake thusly:
> For bonus points: write a program that will find all the places in
> the code that a naked return (without RETURN_UNGCPRO) is being called
> from within a GCPRO'ed region of code.
Not sure if this is what you want, but I hacked together a
quick Perl script which probably comes close (although it
finds a bunch of stuff in comments as well as bits you
actually care about):
Thanks! Here's the fix.
2000-11-14 Yoshiki Hayashi <yoshiki(a)xemacs.org>
* device-msw.c:
* eldap.c:
* event-Xt.c:
* event-stream.c:
* print.c:
Do UNGCPRO before return.
Index: device-msw.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/device-msw.c,v
retrieving revision 1.20.2.26
diff -u -r1.20.2.26 device-msw.c
--- device-msw.c 2000/09/20 02:38:26 1.20.2.26
+++ device-msw.c 2000/11/14 06:12:44
@@ -1019,6 +1019,7 @@
ldm_current->printer_name = xstrdup (ldm_new->printer_name);
}
+ UNGCPRO;
return DEVICE_MSPRINTER_DEVMODE (d);
}
Index: eldap.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/eldap.c,v
retrieving revision 1.13.2.19
diff -u -r1.13.2.19 eldap.c
--- eldap.c 2000/10/31 13:15:17 1.13.2.19
+++ eldap.c 2000/11/14 06:12:47
@@ -701,8 +701,6 @@
Lisp_Object values = Qnil;
struct gcpro gcpro1, gcpro2;
- GCPRO2 (current, values);
-
/* Do all the parameter checking */
CHECK_LIVE_LDAP (ldap);
ld = XLDAP (ldap)->ld;
@@ -720,6 +718,8 @@
ldap_mods = alloca_array (LDAPMod, len);
ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len);
i = 0;
+
+ GCPRO2 (current, values);
EXTERNAL_LIST_LOOP (mods, mods)
{
current = XCAR (mods);
Index: event-Xt.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/event-Xt.c,v
retrieving revision 1.41.2.35
diff -u -r1.41.2.35 event-Xt.c
--- event-Xt.c 2000/11/13 08:58:06 1.41.2.35
+++ event-Xt.c 2000/11/14 06:13:04
@@ -1350,10 +1350,10 @@
Lisp_Object l_dndlist = Qnil, l_item = Qnil;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
- GCPRO4 (l_type, l_data, l_dndlist, l_item);
-
if (! frame)
return 0; /* not for us */
+
+ GCPRO4 (l_type, l_data, l_dndlist, l_item);
XSETFRAME (emacs_event->channel, frame);
emacs_event->event_type = misc_user_event;
Index: event-stream.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/event-stream.c,v
retrieving revision 1.45.2.36
diff -u -r1.45.2.36 event-stream.c
--- event-stream.c 2000/11/13 09:00:31 1.45.2.36
+++ event-stream.c 2000/11/14 06:13:24
@@ -3372,7 +3372,7 @@
{
Vrecent_keys_ring = make_vector (recent_keys_ring_size, Qnil);
/* And return nothing in particular. */
- return make_vector (0, Qnil);
+ RETURN_UNGCPRO (make_vector (0, Qnil));
}
if (NILP (XVECTOR_DATA (Vrecent_keys_ring)[recent_keys_ring_index]))
@@ -3430,7 +3430,6 @@
Lisp_Object new_vector = Qnil;
int i, j, nkeys, start, min;
struct gcpro gcpro1;
- GCPRO1 (new_vector);
CHECK_INT (size);
if (XINT (size) <= 0)
@@ -3438,12 +3437,13 @@
if (XINT (size) == recent_keys_ring_size)
return size;
+ GCPRO1 (new_vector);
new_vector = make_vector (XINT (size), Qnil);
if (NILP (Vrecent_keys_ring))
{
Vrecent_keys_ring = new_vector;
- return size;
+ RETURN_UNGCPRO (size);
}
if (NILP (XVECTOR_DATA (Vrecent_keys_ring)[recent_keys_ring_index]))
Index: print.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/print.c,v
retrieving revision 1.27.2.25
diff -u -r1.27.2.25 print.c
--- print.c 2000/11/06 05:43:12 1.27.2.25
+++ print.c 2000/11/14 06:14:08
@@ -1420,6 +1420,7 @@
write_char_internal ("#", printcharfun);
print_internal (XCDR (tem), printcharfun, escapeflag);
write_char_internal ("#", printcharfun);
+ UNGCPRO;
return;
}
else
--
Yoshiki Hayashi