* ext/dl/lib/dl/func.rb (call): don't overwrite original arguments
to defend from GC. * test/dl/test_func.rb (test_string): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b652b55c51
commit
db4a0d42dd
@ -1,3 +1,9 @@
|
||||
Sat Jun 26 04:39:12 2010 Masaya Tarui <tarui@ruby-lnag.org>
|
||||
|
||||
* ext/dl/lib/dl/func.rb (call): don't overwrite original arguments
|
||||
to defend from GC.
|
||||
* test/dl/test_func.rb (test_string): add test for above.
|
||||
|
||||
Fri Jun 25 11:45:36 2010 James Edward Gray II <jeg2@ruby-lang.org>
|
||||
|
||||
* lib/csv.rb: Fixing a bug that prevented CSV from parsing
|
||||
|
@ -55,8 +55,8 @@ module DL
|
||||
super
|
||||
else
|
||||
funcs = []
|
||||
args = wrap_args(args, @stack.types, funcs, &block)
|
||||
r = @cfunc.call(@stack.pack(args))
|
||||
_args = wrap_args(args, @stack.types, funcs, &block)
|
||||
r = @cfunc.call(@stack.pack(_args))
|
||||
funcs.each{|f| f.unbind_at_call()}
|
||||
return wrap_result(r)
|
||||
end
|
||||
|
@ -46,6 +46,18 @@ module DL
|
||||
assert_equal("123", str.to_s)
|
||||
end
|
||||
|
||||
def test_string()
|
||||
stress, GC.stress = GC.stress, true
|
||||
f = Function.new(CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy'),
|
||||
[TYPE_VOIDP, TYPE_VOIDP])
|
||||
buff = "000"
|
||||
str = f.call(buff, "123")
|
||||
assert_equal("123", buff)
|
||||
assert_equal("123", str.to_s)
|
||||
ensure
|
||||
GC.stress = stress
|
||||
end
|
||||
|
||||
def test_isdigit()
|
||||
f = Function.new(CFunc.new(@libc['isdigit'], TYPE_INT, 'isdigit'),
|
||||
[TYPE_INT])
|
||||
|
Loading…
x
Reference in New Issue
Block a user