From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: port initialization? Date: 08 Aug 2002 19:33:52 +0200 Sender: guile-devel-admin@gnu.org Message-ID: References: <15693.15724.416839.636665@blauw.xs4all.nl> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1028828062 10479 127.0.0.1 (8 Aug 2002 17:34:22 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 8 Aug 2002 17:34:22 +0000 (UTC) Cc: guile-devel@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17crAy-0002iu-00 for ; Thu, 08 Aug 2002 19:34:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17crBg-0005Rv-00; Thu, 08 Aug 2002 13:35:04 -0400 Original-Received: from krusty.dt.e-technik.uni-dortmund.de ([129.217.163.1] helo=mail.dt.e-technik.uni-dortmund.de) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17crAq-0005Ka-00 for ; Thu, 08 Aug 2002 13:34:12 -0400 Original-Received: from burns.dt.e-technik.uni-dortmund.de (burns.dt.e-technik.uni-dortmund.de [129.217.163.19]) by mail.dt.e-technik.uni-dortmund.de (Postfix) with ESMTP id 4E3F6A3833; Thu, 8 Aug 2002 19:34:11 +0200 (CEST) Original-Received: by burns.dt.e-technik.uni-dortmund.de (Postfix, from userid 520) id DEC602613A; Thu, 8 Aug 2002 19:33:53 +0200 (CEST) Original-To: hanwen@cs.uu.nl In-Reply-To: <15693.15724.416839.636665@blauw.xs4all.nl> Original-Lines: 30 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1015 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1015 Han-Wen writes: > what about > > z = scm_cell (scm_tc16_strport, 0); > SCM_DEFER_INTS; > pt = scm_add_to_port_table (z); > SCM_SET_CELL_TYPE (z, scm_tc16_strport | modes); > SCM_SETPTAB_ENTRY (z, pt); > SCM_SETSTREAM (z, SCM_UNPACK (str)); > > This looks like fishy code to me. When scm_add_to_port_table triggers > GC then it will see the (scm_tc16_strport, 0) cell, which is (or > should be) invalid. Yes, but the GC will not notice since "z" still refers to it and therefore the port cell wont be freed. So we are safe. It's a little fishy, yes. We could flag the port as closed until its ptab_entry is set properly. Closed ports do also have a NULL ptab_entry. > Why not > [...] > { > scm_t_port *newport = scm_add_to_port_table (); > SCM port = scm_cell (scm_tc16_port, newport); > newport->port = port; > .. > } This will leak newport when the call to scm_cell throws. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel