[Top][All Lists]

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

Re: Implementing R6RS `transcoded-port'

From: Thien-Thi Nguyen
Subject: Re: Implementing R6RS `transcoded-port'
Date: Mon, 26 Jul 2010 10:21:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

() Andreas Rottmann <address@hidden>
() Sun, 25 Jul 2010 21:12:22 +0200

       result_pt->file_name = pt->file_name;
       result_pt->line_number = pt->line_number;
       result_pt->column_number = pt->column_number;

       result_pt->read_buf = pt->read_buf;
       result_pt->read_pos = pt->read_pos;
       result_pt->read_end = pt->read_end;
       result_pt->read_buf_size = pt->read_buf_size;

       result_pt->saved_read_buf = pt->saved_read_buf;
       result_pt->saved_read_pos = pt->saved_read_pos;
       result_pt->saved_read_end = pt->saved_read_end;
       result_pt->saved_read_buf_size = pt->saved_read_buf_size;

       result_pt->write_buf = pt->write_buf;
       result_pt->write_pos = pt->write_pos;
       result_pt->write_end = pt->write_end;
       result_pt->write_buf_size = pt->write_buf_size;

       result_pt->shortbuf = pt->shortbuf;
       result_pt->rw_random = pt->rw_random;
       result_pt->rw_active = pt->rw_active;
       result_pt->putback_buf = pt->putback_buf;
       result_pt->putback_buf_size = pt->putback_buf_size; 

       scm_i_remove_port (port);
       SCM_CLR_PORT_OPEN_FLAG (port);

Most likely ‘scm_i_remove_port’ arranges to clean up pt->FOO, so ‘gc’
ends up leaving some these assigned members (result_pt->FOO) pointing to
"valid" memory with invalid contents.  For those, a pointer copy is
insufficient; you need to copy their contents to newly allocated memory.

reply via email to

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