[macruby-changes] [229] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue May 27 16:44:52 PDT 2008


Revision: 229
          http://trac.macosforge.org/projects/ruby/changeset/229
Author:   lsansonetti at apple.com
Date:     2008-05-27 16:44:51 -0700 (Tue, 27 May 2008)

Log Message:
-----------
fixing bugs so that real YAML content can be emitted

Modified Paths:
--------------
    MacRuby/trunk/ext/syck/syck.c
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/ext/syck/syck.c
===================================================================
--- MacRuby/trunk/ext/syck/syck.c	2008-05-27 23:44:12 UTC (rev 228)
+++ MacRuby/trunk/ext/syck/syck.c	2008-05-27 23:44:51 UTC (rev 229)
@@ -157,7 +157,11 @@
 syck_new_parser(void)
 {
     SyckParser *p;
+#if WITH_OBJC
+    p = xmalloc(sizeof(SyckParser));
+#else
     p = S_ALLOC( SyckParser );
+#endif
     S_MEMZERO( p, SyckParser, 1 );
     p->lvl_capa = ALLOC_CT;
     p->levels = S_ALLOC_N( SyckLevel, p->lvl_capa ); 

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2008-05-27 23:44:12 UTC (rev 228)
+++ MacRuby/trunk/string.c	2008-05-27 23:44:51 UTC (rev 229)
@@ -565,9 +565,9 @@
 	    }
 	}
     }
+    rb_gc_malloc_increase(32 + (sizeof(UniChar) * len));
     if (need_padding)
 	CFStringPad((CFMutableStringRef)str, CFSTR(" "), len, 0);
-    rb_gc_malloc_increase(32 + (sizeof(UniChar) * len));
 #else
     if (len > RSTRING_EMBED_LEN_MAX) {
 	RSTRING(str)->as.heap.aux.capa = len;
@@ -611,10 +611,12 @@
 VALUE
 rb_str_new2(const char *ptr)
 {
+    long len;
     if (!ptr) {
 	rb_raise(rb_eArgError, "NULL pointer given");
     }
-    return rb_str_new(ptr, strlen(ptr));
+    len = strlen(ptr);
+    return rb_str_new(len == 0 ? NULL : ptr, len);
 }
 
 VALUE

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080527/790ca472/attachment.htm 


More information about the macruby-changes mailing list