[uim-commit] r1446 - in branches/r5rs: sigscheme uim
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Sep 6 17:08:49 PDT 2005
Author: yamaken
Date: 2005-09-06 17:08:46 -0700 (Tue, 06 Sep 2005)
New Revision: 1446
Modified:
branches/r5rs/sigscheme/datas.c
branches/r5rs/sigscheme/sigscheme.c
branches/r5rs/sigscheme/sigscheme.h
branches/r5rs/uim/uim-scm.c
Log:
* This commit fixes a serious API design bug of GC. What to be
protected by the API is not a ScmObj itself but a C variable that is
holding a ScmObj
* sigscheme/sigscheme.h
- (SigScm_GC_Protect): Fix the argument type ScmObj with ScmObj *
* sigscheme/datas.c
- (struct gc_protected_obj_):
* Fix the type ScmObj with ScmObj *
* Add a comment about the struct
- (SigScm_GC_Protect): Fix the argument type ScmObj with ScmObj *
- (gc_mark_protected_obj): Follow the change
* sigscheme/sigscheme.c
- (SigScm_Initialize): Follow the change
* uim/uim-scm.c
- (uim_scm_gc_protect): Follow the change
Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c 2005-09-06 22:47:12 UTC (rev 1445)
+++ branches/r5rs/sigscheme/datas.c 2005-09-07 00:08:46 UTC (rev 1446)
@@ -96,10 +96,10 @@
=======================================*/
typedef ScmObj ScmObjHeap;
-/* Represent protected from GC object */
+/* Represents C variable that is holding a ScmObj to be protected from GC */
typedef struct gc_protected_obj_ gc_protected_obj;
struct gc_protected_obj_ {
- ScmObj obj;
+ ScmObj *obj;
gc_protected_obj *next_obj;
};
@@ -378,7 +378,7 @@
}
}
-void SigScm_GC_Protect(ScmObj obj)
+void SigScm_GC_Protect(ScmObj *obj)
{
gc_protected_obj *item = (gc_protected_obj*)malloc(sizeof(gc_protected_obj));
item->obj = obj;
@@ -424,7 +424,7 @@
{
gc_protected_obj *item = NULL;
for (item = protected_obj_list; item; item = item->next_obj) {
- mark_obj(item->obj);
+ mark_obj(*item->obj);
}
}
Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c 2005-09-06 22:47:12 UTC (rev 1445)
+++ branches/r5rs/sigscheme/sigscheme.c 2005-09-07 00:08:46 UTC (rev 1446)
@@ -301,9 +301,9 @@
scm_current_input_port = Scm_NewFilePort(stdin, "stdin", PORT_INPUT);
scm_current_output_port = Scm_NewFilePort(stdout, "stdout", PORT_OUTPUT);
scm_current_error_port = Scm_NewFilePort(stderr, "stderr", PORT_OUTPUT);
- SigScm_GC_Protect(scm_current_input_port);
- SigScm_GC_Protect(scm_current_output_port);
- SigScm_GC_Protect(scm_current_error_port);
+ SigScm_GC_Protect(&scm_current_input_port);
+ SigScm_GC_Protect(&scm_current_output_port);
+ SigScm_GC_Protect(&scm_current_error_port);
#if SCM_USE_SRFI1
/*=======================================================================
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-09-06 22:47:12 UTC (rev 1445)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-09-07 00:08:46 UTC (rev 1446)
@@ -136,7 +136,7 @@
/* datas.c */
void SigScm_InitStorage(void);
void SigScm_FinalizeStorage(void);
-void SigScm_GC_Protect(ScmObj obj);
+void SigScm_GC_Protect(ScmObj *obj);
void SigScm_GC_ProtectStack(ScmObj *stack_start);
void SigScm_GC_UnprotectStack(ScmObj *stack_start);
ScmObj Scm_NewCons(ScmObj a, ScmObj b);
Modified: branches/r5rs/uim/uim-scm.c
===================================================================
--- branches/r5rs/uim/uim-scm.c 2005-09-06 22:47:12 UTC (rev 1445)
+++ branches/r5rs/uim/uim-scm.c 2005-09-07 00:08:46 UTC (rev 1446)
@@ -190,7 +190,7 @@
void
uim_scm_gc_protect(uim_lisp *location)
{
- SigScm_GC_Protect((ScmObj)(*location));
+ SigScm_GC_Protect((ScmObj *)location);
}
void
More information about the uim-commit
mailing list