[uim-commit] r2671 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Tue Dec 20 12:39:56 PST 2005


Author: yamaken
Date: 2005-12-20 12:39:46 -0800 (Tue, 20 Dec 2005)
New Revision: 2671

Modified:
   branches/r5rs/sigscheme/io.c
   branches/r5rs/sigscheme/operations-siod.c
   branches/r5rs/sigscheme/storage-continuation.c
   branches/r5rs/sigscheme/storage.c
Log:
* sigscheme/io.c
  - (scm_init_io): Fix possible object corruption on GC
* sigscheme/storage.c
  - (scm_init_storage): Standardize GC protection procedure although
    this cases do not cause the corruption
* sigscheme/storage-continuation.c
  - (scm_init_continuation, initialize_dynamic_extent,
    initialize_continuation_env): Ditto
* sigscheme/operations-siod.c
  - (scm_initialize_siod): Ditto


Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c	2005-12-20 20:32:39 UTC (rev 2670)
+++ branches/r5rs/sigscheme/io.c	2005-12-20 20:39:46 UTC (rev 2671)
@@ -95,12 +95,12 @@
     scm_sbcport_init();
 #endif
 
+    scm_gc_protect(&scm_in);
+    scm_gc_protect(&scm_out);
+    scm_gc_protect(&scm_err);
     scm_in  = scm_make_shared_file_port(stdin, "stdin", SCM_PORTFLAG_INPUT);
     scm_out = scm_make_shared_file_port(stdout, "stdout", SCM_PORTFLAG_OUTPUT);
     scm_err = scm_make_shared_file_port(stderr, "stderr", SCM_PORTFLAG_OUTPUT);
-    scm_gc_protect(&scm_in);
-    scm_gc_protect(&scm_out);
-    scm_gc_protect(&scm_err);
 }
 
 void
@@ -120,7 +120,7 @@
 }
 
 ScmObj scm_make_shared_file_port(FILE *file, const char *aux_info,
-                              enum ScmPortFlag flag)
+                                 enum ScmPortFlag flag)
 {
     ScmBytePort *bport;
 

Modified: branches/r5rs/sigscheme/operations-siod.c
===================================================================
--- branches/r5rs/sigscheme/operations-siod.c	2005-12-20 20:32:39 UTC (rev 2670)
+++ branches/r5rs/sigscheme/operations-siod.c	2005-12-20 20:39:46 UTC (rev 2671)
@@ -109,12 +109,12 @@
     scm_define_alias("bit-xor", "logxor");
     scm_define_alias("bit-not", "lognot");
 
+    scm_gc_protect(&null_port);
+    scm_gc_protect(&saved_output_port);
+    scm_gc_protect(&saved_error_port);
     null_port         = SCM_FALSE;
     saved_output_port = SCM_FALSE;
     saved_error_port  = SCM_FALSE;
-    scm_gc_protect(&null_port);
-    scm_gc_protect(&saved_output_port);
-    scm_gc_protect(&saved_error_port);
 
     scm_nullport_init();
     null_port = scm_make_port(scm_make_char_port(ScmNullPort_new()),

Modified: branches/r5rs/sigscheme/storage-continuation.c
===================================================================
--- branches/r5rs/sigscheme/storage-continuation.c	2005-12-20 20:32:39 UTC (rev 2670)
+++ branches/r5rs/sigscheme/storage-continuation.c	2005-12-20 20:39:46 UTC (rev 2671)
@@ -108,8 +108,8 @@
     initialize_dynamic_extent();
     initialize_continuation_env();
 
+    scm_gc_protect((ScmObj *)&trace_stack);
     trace_stack = SCM_NULL;
-    scm_gc_protect((ScmObj *)&trace_stack);
 }
 
 void
@@ -129,8 +129,8 @@
 static void
 initialize_dynamic_extent(void)
 {
+    scm_gc_protect((ScmObj *)&current_dynamic_extent);
     current_dynamic_extent = SCM_NULL;
-    scm_gc_protect((ScmObj *)&current_dynamic_extent);
 }
 
 static void
@@ -214,8 +214,8 @@
 static void
 initialize_continuation_env(void)
 {
+    scm_gc_protect((ScmObj *)&continuation_stack);
     continuation_stack = SCM_NULL;
-    scm_gc_protect((ScmObj *)&continuation_stack);
 }
 
 static void

Modified: branches/r5rs/sigscheme/storage.c
===================================================================
--- branches/r5rs/sigscheme/storage.c	2005-12-20 20:32:39 UTC (rev 2670)
+++ branches/r5rs/sigscheme/storage.c	2005-12-20 20:39:46 UTC (rev 2671)
@@ -89,7 +89,7 @@
   Function Implementations
 =======================================*/
 void scm_init_storage(size_t heap_size, size_t heap_alloc_threshold,
-                        int n_heaps_max, int n_heaps_init)
+                      int n_heaps_max, int n_heaps_init)
 {
     initialize_special_constants();
 
@@ -105,9 +105,9 @@
      * To keep storage model abstract, the cell is allocated from a heap
      * instead of directly construct ScmCell
      */
+    scm_gc_protect(&scm_null_values);
     scm_null_values = CONS(SCM_NULL, SCM_NULL);
     SCM_ENTYPE_VALUEPACKET(scm_null_values);
-    scm_gc_protect(&scm_null_values);
 #endif
 
     scm_init_continuation();



More information about the uim-commit mailing list