Skip to content

Commit 88b3424

Browse files
committed
Remove FFI constant from File/IO to fix issue extending FFI from File
1 parent 8033925 commit 88b3424

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Bug fixes:
99
* Fixed return value of `Enumerable#first` (#2056, @LillianZ).
1010
* Improve reliability of the post install hook by disabling RubyGems (#2075).
1111
* Fixed top level exception handler to print exception cause (#2013).
12+
* Fixed issue when extending FFI from File (#2094).
1213

1314
Compatibility:
1415

src/main/ruby/truffleruby/core/file.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ module Constants
102102
FNM_SYSCASE = File::FNM_SYSCASE
103103
end
104104

105-
FFI = Truffle::FFI
106-
107105
SEPARATOR = '/'
108106
Separator = SEPARATOR
109107
ALT_SEPARATOR = nil
@@ -847,7 +845,7 @@ def self.readable_real?(path)
847845
# File.symlink("testfile", "link2test") #=> 0
848846
# File.readlink("link2test") #=> "testfile"
849847
def self.readlink(path)
850-
FFI::MemoryPointer.new(Truffle::Platform::PATH_MAX) do |ptr|
848+
Truffle::FFI::MemoryPointer.new(Truffle::Platform::PATH_MAX) do |ptr|
851849
n = POSIX.readlink Truffle::Type.coerce_to_path(path), ptr, Truffle::Platform::PATH_MAX
852850
Errno.handle if n == -1
853851

src/main/ruby/truffleruby/core/io.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636

3737
class IO
38-
FFI = Truffle::FFI
3938

4039
include Enumerable
4140

@@ -1560,7 +1559,7 @@ def ioctl(command, arg = 0)
15601559
# Most Linux ioctl codes predate the convention, so a fallback like this
15611560
# is still necessary.
15621561
buffer_size = 4096 if buffer_size < 4096
1563-
buffer = FFI::MemoryPointer.new(buffer_size)
1562+
buffer = Truffle::FFI::MemoryPointer.new(buffer_size)
15641563
buffer.write_string(arg, arg.bytesize)
15651564
real_arg = buffer.address
15661565
else

0 commit comments

Comments
 (0)