[svn:parrot] r44206 - branches/sys_mem_reduce/src/io
bacek at svn.parrot.org
bacek at svn.parrot.org
Fri Feb 19 22:44:13 UTC 2010
Author: bacek
Date: Fri Feb 19 22:44:13 2010
New Revision: 44206
URL: https://trac.parrot.org/parrot/changeset/44206
Log:
Update src/io to use GC allocations
Modified:
branches/sys_mem_reduce/src/io/buffer.c
branches/sys_mem_reduce/src/io/core.c
Modified: branches/sys_mem_reduce/src/io/buffer.c
==============================================================================
--- branches/sys_mem_reduce/src/io/buffer.c Fri Feb 19 22:43:48 2010 (r44205)
+++ branches/sys_mem_reduce/src/io/buffer.c Fri Feb 19 22:44:13 2010 (r44206)
@@ -99,14 +99,14 @@
buffer_size = Parrot_io_get_buffer_size(interp, filehandle);
if (buffer_start && (buffer_flags & PIO_BF_MALLOC)) {
- mem_sys_free(buffer_start);
+ mem_gc_free(interp, buffer_start);
Parrot_io_set_buffer_start(interp, filehandle, NULL);
Parrot_io_set_buffer_next(interp, filehandle, NULL);
buffer_start = buffer_next = NULL;
}
if (buffer_size > 0) {
- buffer_start = buffer_next = (unsigned char *)mem_sys_allocate(buffer_size);
+ buffer_start = buffer_next = mem_gc_allocate_n_typed(interp, buffer_size, unsigned char);
Parrot_io_set_buffer_start(interp, filehandle, buffer_start);
Parrot_io_set_buffer_next(interp, filehandle, buffer_next);
buffer_flags |= PIO_BF_MALLOC;
Modified: branches/sys_mem_reduce/src/io/core.c
==============================================================================
--- branches/sys_mem_reduce/src/io/core.c Fri Feb 19 22:43:48 2010 (r44205)
+++ branches/sys_mem_reduce/src/io/core.c Fri Feb 19 22:44:13 2010 (r44206)
@@ -64,12 +64,12 @@
}
- interp->piodata = mem_allocate_typed(ParrotIOData);
+ interp->piodata = mem_gc_allocate_zeroed_typed(interp, ParrotIOData);
if (interp->piodata == NULL)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
"PIO alloc piodata failure.");
interp->piodata->table =
- (PMC **)mem_sys_allocate_zeroed(PIO_NR_OPEN * sizeof (PMC *));
+ mem_gc_allocate_n_zeroed_typed(interp, PIO_NR_OPEN, PMC *);
if (!interp->piodata->table)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
@@ -95,9 +95,9 @@
/*
* TODO free IO of std-handles
*/
- mem_sys_free(interp->piodata->table);
+ mem_gc_free(interp, interp->piodata->table);
interp->piodata->table = NULL;
- mem_sys_free(interp->piodata);
+ mem_gc_free(interp, interp->piodata);
interp->piodata = NULL;
}
More information about the parrot-commits
mailing list