Author: yamakenz
Date: Mon Aug  6 13:54:32 2007
New Revision: 4800

Modified:
   sigscheme-trunk/NEWS
   sigscheme-trunk/QALog
   sigscheme-trunk/src/write.c

Log:
* src/write.c
  - (hash_grow):
    * Fix misinitialized keys with SCM_INVALID. Original implementation assumed
      that SCM_INVALID == 0 and so only initialized by calloc()
    * Replace scm_calloc() with scm_malloc() for efficiency
  - (write_ss_internal): Replace scm_calloc() with scm_malloc() for efficiency
* NEWS
* QALog
  - Update


Modified: sigscheme-trunk/NEWS
==============================================================================
--- sigscheme-trunk/NEWS        (original)
+++ sigscheme-trunk/NEWS        Mon Aug  6 13:54:32 2007
@@ -15,7 +15,7 @@
 
   - R5RS promises (delay and force)
 
-  - New syntax let-optionals* compatible with Gauche for optional argument
+  - New syntax let-optionals* compatible with Gauche, for optional argument
     processing
 
   - %%require-module and scm_require_module(). 'use' and scm_use() have been
@@ -62,6 +62,8 @@
 
   - [R5RS] Fix multiple values inacceptance of call-with-values continuation
     such as (receive (x y) (call/cc (lambda (k) (k 0 1))))
+
+  - [SRFI-38] Fix broken execution by misinitialized internal hash table
 
   - [R5RS] Fix error on (integer->char 0) on non-Unicode codecs
 

Modified: sigscheme-trunk/QALog
==============================================================================
--- sigscheme-trunk/QALog       (original)
+++ sigscheme-trunk/QALog       Mon Aug  6 13:54:32 2007
@@ -740,10 +740,10 @@
 
 file:              write.c
 category:          semicore
-spec by eyes:      [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
+spec by eyes:      [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], 
[EMAIL PROTECTED]
 spec by tests:     
 general review:    [EMAIL PROTECTED]
-64-bit by eyes:    [EMAIL PROTECTED]
+64-bit by eyes:    [EMAIL PROTECTED], [EMAIL PROTECTED]
 64-bit by tests:   
 coding style:      [EMAIL PROTECTED]
 normal case tests: 
@@ -1093,6 +1093,11 @@
 
 Log
 ---
+2007-08-07  YamaKen <yamaken AT bp.iij4u.or.jp>
+        * write.c
+          - Fix misinitialized hash table and QA done again @r4800 for hash
+            tables
+
 2007-07-21  YamaKen <yamaken AT bp.iij4u.or.jp>
         * number-io.c
           - QA done again @r4760 for scm_string2number()

Modified: sigscheme-trunk/src/write.c
==============================================================================
--- sigscheme-trunk/src/write.c (original)
+++ sigscheme-trunk/src/write.c Mon Aug  6 13:54:32 2007
@@ -626,9 +626,11 @@
     new_size = old_size * 2;
     old_ents = tab->ents;
 
-    tab->ents = scm_calloc(new_size, sizeof(scm_hash_entry));
+    tab->ents = scm_malloc(new_size * sizeof(scm_hash_entry));
     tab->size = new_size;
     tab->used = 0;
+    for (i = 0; i < new_size; i++)
+        tab->ents[i].key = SCM_INVALID;
 
     for (i = 0; i < old_size; i++)
         hash_lookup(tab, old_ents[i].key, old_ents[i].datum, HASH_INSERT);
@@ -797,10 +799,9 @@
 
     ctx.next_index = 1;
     ctx.seen.size = 1 << 8; /* arbitrary initial size */
-    ctx.seen.ents = scm_calloc(ctx.seen.size, sizeof(scm_hash_entry));
-    for (i = 0; i < ctx.seen.size; i++) {
+    ctx.seen.ents = scm_malloc(ctx.seen.size * sizeof(scm_hash_entry));
+    for (i = 0; i < ctx.seen.size; i++)
         ctx.seen.ents[i].key = SCM_INVALID;
-    }
 
     write_ss_scan(obj, &ctx);
 

Reply via email to