[macruby-changes] [5100] MacRuby/trunk/pack.c

source_changes at macosforge.org source_changes at macosforge.org
Sun Jan 2 02:17:13 PST 2011


Revision: 5100
          http://trac.macosforge.org/projects/ruby/changeset/5100
Author:   watson1978 at gmail.com
Date:     2011-01-02 02:17:08 -0800 (Sun, 02 Jan 2011)
Log Message:
-----------
Fixed a bug of String#unpack with block. Fixed a #1083.

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

Modified: MacRuby/trunk/pack.c
===================================================================
--- MacRuby/trunk/pack.c	2011-01-02 07:42:04 UTC (rev 5099)
+++ MacRuby/trunk/pack.c	2011-01-02 10:17:08 UTC (rev 5100)
@@ -1196,7 +1196,12 @@
     PACK_LENGTH_ADJUST_SIZE(sizeof(type))
 #endif
 
-#define PACK_ITEM_ADJUST() while (tmp--) rb_ary_push(ary, Qnil)
+#define PACK_ITEM_ADJUST() do {				\
+	if (!block_p) {					\
+	    while (tmp--) rb_ary_push(ary, Qnil);	\
+	}						\
+    }							\
+    while (0)
 
 static VALUE
 infected_str_new(const char *ptr, long len, VALUE str)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110102/ac9c20de/attachment.html>


More information about the macruby-changes mailing list