1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* pack.c (PACK_ITEM_ADJUST): return nil not result array and yield

values if block is given.  [ruby-core:33193]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-11-15 21:39:39 +00:00
parent 0dbe6b6113
commit 8b09bf2a72
3 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Tue Nov 16 06:39:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* pack.c (PACK_ITEM_ADJUST): return nil not result array and yield
values if block is given. [ruby-core:33193]
Tue Nov 16 00:21:20 2010 Yusuke Endoh <mame@tsg.ne.jp>
* regparse.c (and_cclass, or_cclass): fix memory leak. Coverity Scan

2
pack.c
View file

@ -1221,7 +1221,7 @@ hex2num(char c)
} while (0)
#define PACK_ITEM_ADJUST() do { \
if (tmp_len > 0) \
if (tmp_len > 0 && !block_p) \
rb_ary_store(ary, RARRAY_LEN(ary)+tmp_len-1, Qnil); \
} while (0)

View file

@ -630,4 +630,11 @@ class TestPack < Test::Unit::TestCase
assert_equal([1,nil], str.unpack("#{fmt}2"))
}
end
def test_short_with_block
bug4059 = '[ruby-core:33193]'
result = :ok
assert_nil("".unpack("i") {|x| result = x}, bug4059)
assert_equal(:ok, result)
end
end