Skip to content

Commit 2216955

Browse files
committed
Implement FFI::Pointer#clear
1 parent f1d7c7b commit 2216955

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Bug fixes:
1111
* Calling `Kernel#raise` with a raised exception will no longer set the cause of the exception to itself (#1682).
1212
* Return a `FFI::Function` correctly for functions returning a callback.
1313
* Convert to intuitive Ruby exceptions when INVOKE fails (#1690).
14+
* Implemented `FFI::Pointer#clear` (#1687).
1415

1516
Compatibility
1617

src/main/ruby/core/truffle/ffi/pointer.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ def initialize_copy(from)
8686
self
8787
end
8888

89+
def clear
90+
raise RuntimeError, 'cannot clear unbounded memory area' unless @total
91+
Truffle.invoke_primitive :pointer_clear, self, @total
92+
end
93+
8994
def inspect
9095
# Don't have this print the data at the location. It can crash everything.
9196
addr = address()

0 commit comments

Comments
 (0)