[uim-commit] r1960 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Thu Nov 3 03:12:52 PST 2005
Author: yamaken
Date: 2005-11-03 03:12:48 -0800 (Thu, 03 Nov 2005)
New Revision: 1960
Modified:
branches/r5rs/sigscheme/strport.c
Log:
* sigscheme/strport.c
- (istrport_close, ostrport_close): Move the responsibility freeing
port->str to finalizer
Modified: branches/r5rs/sigscheme/strport.c
===================================================================
--- branches/r5rs/sigscheme/strport.c 2005-11-03 10:58:44 UTC (rev 1959)
+++ branches/r5rs/sigscheme/strport.c 2005-11-03 11:12:48 UTC (rev 1960)
@@ -219,10 +219,13 @@
static int
istrport_close(ScmInputStrPort *port)
{
- if (port->finalize)
+ if (port->finalize) {
+ /* custom finalizer be responsible for freeing port->str */
(*port->finalize)(&port->str, port->has_str_ownership, &port->opaque);
- if (port->has_str_ownership)
- free(port->str);
+ } else {
+ if (port->has_str_ownership)
+ free(port->str);
+ }
free(port);
return OK;
@@ -328,9 +331,12 @@
static int
ostrport_close(ScmOutputStrPort *port)
{
- if (port->finalize)
+ if (port->finalize) {
+ /* custom finalizer be responsible for freeing port->str */
(*port->finalize)(&port->str, port->buf_size, &port->opaque);
- free(port->str);
+ } else {
+ free(port->str);
+ }
free(port);
return OK;
More information about the uim-commit
mailing list