diff options
author | Sutou Kouhei <kou@clear-code.com> | 2021-02-17 16:54:35 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-05-18 12:48:40 +0900 |
commit | ab5212b3c9e696b13a5959e22df75db7b54fed93 (patch) | |
tree | b664e8587daddb5fc135d24646e867dff29ca10e /ext | |
parent | 4d1bb460f64eafacc2ef8c4116a1bbe7e63e732f (diff) | |
download | ruby-ab5212b3c9e696b13a5959e22df75db7b54fed93.tar.gz |
[ruby/fiddle] Add support for "const" in type
GitHub: fix #68
Reported by kojix2. Thanks!!!
https://github.com/ruby/fiddle/commit/d7322c234a
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fiddle/lib/fiddle/cparser.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/fiddle/lib/fiddle/cparser.rb b/ext/fiddle/lib/fiddle/cparser.rb index 8a269393c6..93a05513c9 100644 --- a/ext/fiddle/lib/fiddle/cparser.rb +++ b/ext/fiddle/lib/fiddle/cparser.rb @@ -148,9 +148,11 @@ module Fiddle # def parse_ctype(ty, tymap=nil) tymap ||= {} - case ty - when Array + if ty.is_a?(Array) return [parse_ctype(ty[0], tymap), ty[1]] + end + ty = ty.gsub(/\Aconst\s+/, "") + case ty when 'void' return TYPE_VOID when /\A(?:(?:signed\s+)?long\s+long(?:\s+int\s+)?|int64_t)(?:\s+\w+)?\z/ |