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

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Dec 23 08:12:09 PST 2005


Author: yamaken
Date: 2005-12-23 08:12:05 -0800 (Fri, 23 Dec 2005)
New Revision: 2690

Modified:
   branches/r5rs/sigscheme/error.c
   branches/r5rs/sigscheme/io.c
   branches/r5rs/sigscheme/main.c
   branches/r5rs/sigscheme/operations-siod.c
   branches/r5rs/sigscheme/operations-srfi34.c
   branches/r5rs/sigscheme/operations-srfi6.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/storage-continuation.c
   branches/r5rs/sigscheme/storage.c
Log:
* sigscheme/error.c
  - (scm_init_error): Fix possible GC corruption with
    scm_gc_protect_with_init()
* sigscheme/operations-srfi34.c
  - (scm_initialize_srfi34): Ditto
* sigscheme/storage.c
  - (scm_init_storage): Ditto
* sigscheme/operations-srfi6.c
  - (scm_p_srfi6_open_input_string): Ditto
* sigscheme/io.c
  - (scm_init_io): Ditto
* sigscheme/storage-continuation.c
  - (scm_init_continuation, initialize_dynamic_extent,
    initialize_continuation_env): Ditto
* sigscheme/sigscheme.c
  - (scm_initialize_internal): Ditto
* sigscheme/operations-siod.c
  - (scm_initialize_siod): Ditto
* sigscheme/main.c
  - (main): Ditto


Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/error.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -77,13 +77,11 @@
 void
 scm_init_error(void)
 {
-    scm_gc_protect(&err_obj_tag);
-    scm_gc_protect(&str_srfi34);
-
     /* allocate a cons cell as unique ID */
-    err_obj_tag = CONS(SCM_UNDEF, SCM_UNDEF);
+    scm_gc_protect_with_init(&err_obj_tag, CONS(SCM_UNDEF, SCM_UNDEF));
 
-    str_srfi34 = MAKE_IMMUTABLE_STRING_COPYING("srfi-34");
+    scm_gc_protect_with_init(&str_srfi34,
+                             MAKE_IMMUTABLE_STRING_COPYING("srfi-34"));
     srfi34_is_provided = FALSE;
 
     cb_fatal_error = NULL;

Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/io.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -95,12 +95,15 @@
     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_with_init(&scm_in,
+                             scm_make_shared_file_port(stdin, "stdin",
+                                                       SCM_PORTFLAG_INPUT));
+    scm_gc_protect_with_init(&scm_out,
+                             scm_make_shared_file_port(stdout, "stdout",
+                                                       SCM_PORTFLAG_OUTPUT));
+    scm_gc_protect_with_init(&scm_err,
+                             scm_make_shared_file_port(stderr, "stderr",
+                                                       SCM_PORTFLAG_OUTPUT));
 }
 
 void

Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/main.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -179,8 +179,8 @@
 #endif
 
 #if SCM_COMPAT_SIOD
-    scm_gc_protect(&feature_id_siod);
-    feature_id_siod = MAKE_IMMUTABLE_STRING_COPYING(FEATURE_ID_SIOD);
+    scm_gc_protect_with_init(&feature_id_siod,
+                             MAKE_IMMUTABLE_STRING_COPYING(FEATURE_ID_SIOD));
 #endif
 
     if (filename) {

Modified: branches/r5rs/sigscheme/operations-siod.c
===================================================================
--- branches/r5rs/sigscheme/operations-siod.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/operations-siod.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -109,16 +109,13 @@
     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_with_init(&null_port,         SCM_FALSE);
+    scm_gc_protect_with_init(&saved_output_port, SCM_FALSE);
+    scm_gc_protect_with_init(&saved_error_port,  SCM_FALSE);
 
     scm_nullport_init();
     null_port = scm_make_port(scm_make_char_port(ScmNullPort_new()),
-                            SCM_PORTFLAG_INPUT | SCM_PORTFLAG_OUTPUT);
+                              SCM_PORTFLAG_INPUT | SCM_PORTFLAG_OUTPUT);
 
     scm_set_verbose_level(2);
 }

Modified: branches/r5rs/sigscheme/operations-srfi34.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi34.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/operations-srfi34.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -126,10 +126,8 @@
     scm_use("srfi-23");
 
     /* protect global variables */
-    for (var = &global_var_list[0]; *var; var++) {
-        **var = SCM_FALSE;
-        scm_gc_protect(*var);
-    }
+    for (var = &global_var_list[0]; *var; var++)
+        scm_gc_protect_with_init(*var, SCM_FALSE);
 
     errmsg_unhandled_exception
         = MAKE_IMMUTABLE_STRING_COPYING(ERRMSG_UNHANDLED_EXCEPTION);

Modified: branches/r5rs/sigscheme/operations-srfi6.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi6.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/operations-srfi6.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -92,8 +92,7 @@
 
     bport = ScmInputStrPort_new_const(SCM_STRING_STR(str), istrport_finalize);
     hold_str = (ScmObj *)ScmInputStrPort_ref_opaque(bport);
-    *hold_str = str;
-    scm_gc_protect(hold_str);
+    scm_gc_protect_with_init(hold_str, str);
     return scm_make_port(scm_make_char_port(bport), SCM_PORTFLAG_INPUT);
 }
 

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/sigscheme.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -152,8 +152,7 @@
     scm_sym_else             = scm_intern("else");
     scm_sym_yields           = scm_intern("=>");
 
-    scm_gc_protect(&features);
-    features = SCM_NULL;
+    scm_gc_protect_with_init(&features, SCM_NULL);
 
     /*=======================================================================
       Register Built-in Functions

Modified: branches/r5rs/sigscheme/storage-continuation.c
===================================================================
--- branches/r5rs/sigscheme/storage-continuation.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/storage-continuation.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -108,8 +108,7 @@
     initialize_dynamic_extent();
     initialize_continuation_env();
 
-    scm_gc_protect((ScmObj *)&trace_stack);
-    trace_stack = SCM_NULL;
+    scm_gc_protect_with_init((ScmObj *)&trace_stack, SCM_NULL);
 }
 
 void
@@ -129,8 +128,7 @@
 static void
 initialize_dynamic_extent(void)
 {
-    scm_gc_protect((ScmObj *)&current_dynamic_extent);
-    current_dynamic_extent = SCM_NULL;
+    scm_gc_protect_with_init((ScmObj *)&current_dynamic_extent, SCM_NULL);
 }
 
 static void
@@ -214,8 +212,7 @@
 static void
 initialize_continuation_env(void)
 {
-    scm_gc_protect((ScmObj *)&continuation_stack);
-    continuation_stack = SCM_NULL;
+    scm_gc_protect_with_init((ScmObj *)&continuation_stack, SCM_NULL);
 }
 
 static void

Modified: branches/r5rs/sigscheme/storage.c
===================================================================
--- branches/r5rs/sigscheme/storage.c	2005-12-23 15:39:36 UTC (rev 2689)
+++ branches/r5rs/sigscheme/storage.c	2005-12-23 16:12:05 UTC (rev 2690)
@@ -96,8 +96,7 @@
     scm_init_gc(heap_size, heap_alloc_threshold, n_heaps_max, n_heaps_init);
 
 #if 0 && (SCM_COMPAT_SIOD_BUGS && !SCM_OBJ_COMPACT)
-    scm_gc_protect(&scm_true);
-    scm_true = scm_make_int(1);
+    scm_gc_protect_with_init(&scm_true, scm_make_int(1));
 #endif
 
 #if SCM_USE_VALUECONS
@@ -105,8 +104,7 @@
      * 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_gc_protect_with_init(&scm_null_values, CONS(SCM_NULL, SCM_NULL));
     SCM_ENTYPE_VALUEPACKET(scm_null_values);
 #endif
 



More information about the uim-commit mailing list