Skip to content

Commit 896906b

Browse files
committed
Remove fallback code handling a missing type
* The type is always set by tool/generate-native-config.rb.
1 parent 7d39b9b commit 896906b

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

lib/truffle/socket/truffle.rb

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ def self.config(struct_class, base, *fields)
4949
type = Truffle::Config.lookup("#{base}.#{field}.type")
5050
type = if type == 'char_array'
5151
[:char, size]
52-
elsif type
53-
type.to_sym
5452
else
55-
ffi_type_for_size(size)
53+
type.to_sym
5654
end
5755

5856
if !(Array === type) && ::FFI.find_type(type).size != size
@@ -65,17 +63,6 @@ def self.config(struct_class, base, *fields)
6563
struct_class.layout(*layout_args)
6664
end
6765

68-
def self.ffi_type_for_size(size)
69-
case size
70-
when 1 then :char
71-
when 2 then :short
72-
when 4 then :int
73-
when 8 then :long
74-
else
75-
raise ArgumentError, "Unknown type for size #{size}"
76-
end
77-
end
78-
7966
def self.aliases_for_hostname(hostname)
8067
pointer = Foreign.gethostbyname(hostname)
8168
return [] if pointer.null? # Truffle: added null check

0 commit comments

Comments
 (0)