Re-instate this as an arch-independent package, and remove gcc call

We're now assuming that the size of size_t is a long unsigned integer.
In the kernel there's a comment:

/*
 * Most 32 bit architectures use "unsigned int" size_t,
 * and all 64 bit architectures use "unsigned long" size_t.
 */

On 32 bit architectures, an unsigned int is the same size as an unsigned
long anyway, so I think this assumption is OK.
This commit is contained in:
Patrick J Cherry
2017-05-10 11:38:10 +01:00
parent a539a87132
commit 6e75dc4e17

View File

@@ -82,8 +82,8 @@ class CStruct
begin begin
require 'linux/c_struct_sizeof_size_t.rb' require 'linux/c_struct_sizeof_size_t.rb'
rescue LoadError rescue LoadError
warn "Falling back to gcc to determine sizeof size_t." if $VERBOSE warn "netlinkrb: Assuming size_t is a long unsigned int." if $DEBUG
SIZEOF_SIZE_T = Integer(`echo __SIZEOF_SIZE_T__ | gcc -E -P -`) rescue 1.size SIZEOF_SIZE_T = [0].pack("L_").size
end end
define_type :size_t, define_type :size_t,