[macruby-changes] [2102] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 27 16:20:14 PDT 2009


Revision: 2102
          http://trac.macosforge.org/projects/ruby/changeset/2102
Author:   lsansonetti at apple.com
Date:     2009-07-27 16:20:14 -0700 (Mon, 27 Jul 2009)
Log Message:
-----------
fixed GC problems in oniguruma: make sure st.c tables are retained/released appropriately since they use GC memory

Modified Paths:
--------------
    MacRuby/branches/experimental/gc.c
    MacRuby/branches/experimental/include/ruby/intern.h
    MacRuby/branches/experimental/onig/regint.h
    MacRuby/branches/experimental/spec/macruby.mspec

Modified: MacRuby/branches/experimental/gc.c
===================================================================
--- MacRuby/branches/experimental/gc.c	2009-07-27 23:17:31 UTC (rev 2101)
+++ MacRuby/branches/experimental/gc.c	2009-07-27 23:20:14 UTC (rev 2102)
@@ -274,20 +274,22 @@
     }
 }
 
-void
+const void *
 rb_objc_retain(const void *addr)
 {
     if (addr != NULL && !SPECIAL_CONST_P(addr)) {
 	auto_zone_retain(__auto_zone, (void *)addr);
     }
+    return addr;
 }
 
-void
+const void *
 rb_objc_release(const void *addr)
 {
     if (addr != NULL && !SPECIAL_CONST_P(addr)) {
 	auto_zone_release(__auto_zone, (void *)addr);
     }
+    return addr;
 }
 
 void

Modified: MacRuby/branches/experimental/include/ruby/intern.h
===================================================================
--- MacRuby/branches/experimental/include/ruby/intern.h	2009-07-27 23:17:31 UTC (rev 2101)
+++ MacRuby/branches/experimental/include/ruby/intern.h	2009-07-27 23:20:14 UTC (rev 2102)
@@ -329,8 +329,8 @@
 void rb_objc_gc_unregister_thread(void);
 void rb_objc_set_associative_ref(void *, void *, void *);
 void *rb_objc_get_associative_ref(void *, void *);
-void rb_objc_retain(const void *);
-void rb_objc_release(const void *);
+const void *rb_objc_retain(const void *);
+const void *rb_objc_release(const void *);
 # define rb_gc_mark_locations(x,y)
 # define rb_mark_tbl(x)
 # define rb_mark_set(x)

Modified: MacRuby/branches/experimental/onig/regint.h
===================================================================
--- MacRuby/branches/experimental/onig/regint.h	2009-07-27 23:17:31 UTC (rev 2101)
+++ MacRuby/branches/experimental/onig/regint.h	2009-07-27 23:20:14 UTC (rev 2102)
@@ -113,21 +113,32 @@
 
 /* Ruby-specific defines... */
 
-#define onig_st_init_table                  st_init_table
-#define onig_st_init_table_with_size        st_init_table_with_size
-#define onig_st_init_numtable               st_init_numtable
-#define onig_st_init_numtable_with_size     st_init_numtable_with_size
-#define onig_st_init_strtable               st_init_strtable
-#define onig_st_init_strtable_with_size     st_init_strtable_with_size
+const void *rb_objc_retain(const void *addr);
+const void *rb_objc_release(const void *addr);
+
+#define onig_st_init_table(t) \
+    ((st_table *)rb_objc_retain(st_init_table(t)))
+#define onig_st_init_table_with_size(t, s) \
+    ((st_table *)rb_objc_retain(st_init_table_with_size(t, s)))
+#define onig_st_init_numtable() \
+    ((st_table *)rb_objc_retain(st_init_numtable()))
+#define onig_st_init_numtable_with_size(s) \
+    ((st_table *)rb_objc_retain(st_init_numtable_with_size(s)))
+#define onig_st_init_strtable() \
+    ((st_table *)rb_objc_retain(st_init_strtable()))
+#define onig_st_init_strtable_with_size(s) \
+    ((st_table *)rb_objc_retain(st_init_strtable_with_size(s)))
+#define onig_st_copy(t) \
+    ((st_table *)rb_objc_retain(st_copy(t)))
+#define onig_st_free_table(t) \
+    (st_free_table((st_table *)rb_objc_release(t)))
 #define onig_st_delete                      st_delete
 #define onig_st_delete_safe                 st_delete_safe
 #define onig_st_insert                      st_insert
 #define onig_st_lookup                      st_lookup
 #define onig_st_foreach                     st_foreach
 #define onig_st_add_direct                  st_add_direct
-#define onig_st_free_table                  st_free_table
 #define onig_st_cleanup_safe                st_cleanup_safe
-#define onig_st_copy                        st_copy
 #define onig_st_nothing_key_clone           st_nothing_key_clone
 #define onig_st_nothing_key_free            st_nothing_key_free
 /* */

Modified: MacRuby/branches/experimental/spec/macruby.mspec
===================================================================
--- MacRuby/branches/experimental/spec/macruby.mspec	2009-07-27 23:17:31 UTC (rev 2101)
+++ MacRuby/branches/experimental/spec/macruby.mspec	2009-07-27 23:20:14 UTC (rev 2102)
@@ -25,8 +25,11 @@
   # Library specs
   set :library, [
     'library/digest',
+    'library/getoptlong',
     'library/mutex',
     'library/queue',
+    'library/observer',
+    'library/pathname',
     'library/readline',
     'library/stringscanner'
   ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090727/621ee168/attachment.html>


More information about the macruby-changes mailing list