[macruby-changes] [3284] MacRuby/trunk/re.c

source_changes at macosforge.org source_changes at macosforge.org
Sat Jan 16 14:49:55 PST 2010


Revision: 3284
          http://trac.macosforge.org/projects/ruby/changeset/3284
Author:   lsansonetti at apple.com
Date:     2010-01-16 14:49:51 -0800 (Sat, 16 Jan 2010)
Log Message:
-----------
working around what i believe to be a gcc bug

Modified Paths:
--------------
    MacRuby/trunk/re.c

Modified: MacRuby/trunk/re.c
===================================================================
--- MacRuby/trunk/re.c	2010-01-16 19:44:45 UTC (rev 3283)
+++ MacRuby/trunk/re.c	2010-01-16 22:49:51 UTC (rev 3284)
@@ -2194,14 +2194,15 @@
 {
     const char *p = *pp;
     int chmaxlen = rb_enc_mbmaxlen(enc);
-    char *chbuf = ALLOCA_N(char, chmaxlen);
+    char chbuf[5];
     int chlen = 0;
     int byte;
 #if !WITH_OBJC
     int l;
 #endif
 
-    memset(chbuf, 0, chmaxlen);
+    assert(chmaxlen < sizeof(chbuf));
+    memset(chbuf, 0, sizeof(chbuf));
 
     byte = read_escaped_byte(&p, end, err);
     if (byte == -1) {
@@ -2663,7 +2664,7 @@
 
     VALUE code = rb_reg_initialize(obj, cstr, clen, enc, options, err);
 
-//printf("init re %p cstr %p orig str %p charsize %ld enc %p\n", (void *)obj, cstr, (void *)str, charsize, enc);
+//printf("init re %p cstr %p orig str %p charsize %ld enc %p should_free %d\n", (void *)obj, cstr, (void *)str, charsize, enc, should_free);
 
     if (should_free && cstr != NULL) {
 	free(cstr);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100116/84a9360f/attachment.html>


More information about the macruby-changes mailing list