From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: suspicious GCPROs Date: Thu, 16 Mar 2006 15:33:40 +0900 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1142558208 23729 80.91.229.2 (17 Mar 2006 01:16:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Mar 2006 01:16:48 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 17 02:16:14 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FK3Yo-0001uj-4j for ged-emacs-devel@m.gmane.org; Fri, 17 Mar 2006 02:15:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FK3Yn-00011W-Cp for ged-emacs-devel@m.gmane.org; Thu, 16 Mar 2006 20:15:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FJm3P-0000wk-Kv for emacs-devel@gnu.org; Thu, 16 Mar 2006 01:33:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FJm3O-0000vu-0t for emacs-devel@gnu.org; Thu, 16 Mar 2006 01:33:46 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FJm3N-0000vo-Qj for emacs-devel@gnu.org; Thu, 16 Mar 2006 01:33:45 -0500 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FJm7x-00074u-M6 for emacs-devel@gnu.org; Thu, 16 Mar 2006 01:38:30 -0500 Original-Received: from nfs.m17n.org (nfs.m17n.org [192.47.44.7]) by tsukuba.m17n.org (8.13.4/8.13.4/Debian-3) with ESMTP id k2G6XfIp009883 for ; Thu, 16 Mar 2006 15:33:41 +0900 Original-Received: from etlken (etlken.m17n.org [192.47.44.125]) by nfs.m17n.org (8.13.4/8.13.4/Debian-3) with ESMTP id k2G6XfZL032393 for ; Thu, 16 Mar 2006 15:33:41 +0900 Original-Received: from handa by etlken with local (Exim 3.36 #1 (Debian)) id 1FJm3I-00057h-00 for ; Thu, 16 Mar 2006 15:33:40 +0900 Original-To: emacs-devel@gnu.org User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51736 Archived-At: I've just checked all occurrences of GCPRO and found a few suspicious places. Attached is the patch I propose. The first two patches (fileio.c and keymap.c) are clearly necessary because GCPROed variables are not yet initialized when GC occurs. The last two patchs (xfns.c and xterm.c) are also necessary for the same reason, but it seems to me that there's no need of GCPRO in the first place. What do yo think? --- Kenichi Handa handa@m17n.org Index: ChangeLog =================================================================== RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v retrieving revision 1.4950 diff -c -r1.4950 ChangeLog *** ChangeLog 15 Mar 2006 19:41:35 -0000 1.4950 --- ChangeLog 16 Mar 2006 06:22:38 -0000 *************** *** 1,3 **** --- 1,15 ---- + 2006-03-16 Kenichi Handa + + * fileio.c (Fwrite_region): Set visit_file to Qnil before GCPRO + it. + + * keymap.c (map_keymap): Set tail to Qnil before GCPRO it. + + * xfns.c (xg_set_icon): GCPRO `found' after the value is set. + + * xterm.c (x_term_init): GCPRO `s' and `abs_file' after the values + are set. + 2006-03-15 Kim F. Storm * xdisp.c (extend_face_to_end_of_line): Always add space glyph to Index: fileio.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/fileio.c,v retrieving revision 1.562 diff -c -r1.562 fileio.c *** fileio.c 24 Feb 2006 06:46:44 -0000 1.562 --- fileio.c 16 Mar 2006 06:22:38 -0000 *************** *** 5009,5014 **** --- 5009,5015 ---- if (!NILP (start) && !STRINGP (start)) validate_region (&start, &end); + visit_file = Qnil; GCPRO5 (start, filename, visit, visit_file, lockname); filename = Fexpand_file_name (filename, Qnil); Index: keymap.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/keymap.c,v retrieving revision 1.319 diff -c -r1.319 keymap.c *** keymap.c 11 Mar 2006 15:25:03 -0000 1.319 --- keymap.c 16 Mar 2006 06:22:38 -0000 *************** *** 699,704 **** --- 699,705 ---- struct gcpro gcpro1, gcpro2, gcpro3; Lisp_Object tail; + tail = Qnil; GCPRO3 (map, args, tail); map = get_keymap (map, 1, autoload); for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map; Index: xfns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xfns.c,v retrieving revision 1.663 diff -c -r1.663 xfns.c *** xfns.c 12 Mar 2006 01:37:33 -0000 1.663 --- xfns.c 16 Mar 2006 06:22:39 -0000 *************** *** 792,801 **** int result = 0; Lisp_Object found; - GCPRO1 (found); - found = x_find_image_file (file); if (! NILP (found)) { GdkPixbuf *pixbuf; --- 792,800 ---- int result = 0; Lisp_Object found; found = x_find_image_file (file); + GCPRO1 (found); if (! NILP (found)) { GdkPixbuf *pixbuf; Index: xterm.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xterm.c,v retrieving revision 1.903 diff -c -r1.903 xterm.c *** xterm.c 14 Mar 2006 15:38:43 -0000 1.903 --- xterm.c 16 Mar 2006 06:22:39 -0000 *************** *** 10189,10196 **** char *file = "~/.emacs.d/gtkrc"; Lisp_Object s, abs_file; - GCPRO2 (s, abs_file); s = make_string (file, strlen (file)); abs_file = Fexpand_file_name (s, Qnil); if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) --- 10189,10197 ---- char *file = "~/.emacs.d/gtkrc"; Lisp_Object s, abs_file; s = make_string (file, strlen (file)); + abs_file = Qnil; + GCPRO2 (s, abs_file); abs_file = Fexpand_file_name (s, Qnil); if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file)))