diff options
author | Sutou Kouhei <[email protected]> | 2020-07-09 20:19:20 +0900 |
---|---|---|
committer | Sutou Kouhei <[email protected]> | 2020-11-18 09:05:13 +0900 |
commit | ae7b53546ca18b56c23f612b6935e98268a07602 (patch) | |
tree | 6669206356ba05e4ee4d0e34dd99901ad1ea268c /ext/fiddle/fiddle.c | |
parent | 64926d500782cadf578724c3d1e7f59e7aaf200f (diff) |
[ruby/fiddle] Add TYPE_CONST_STRING and SIZEOF_CONST_STRING for "const char *"
Add rb_fiddle_ prefix to conversion functions.h to keep backward
compatibility but value_to_generic() isn't safe for TYPE_CONST_STRING
and not String src. Use rb_fiddle_value_to_generic() instead.
https://github.com/ruby/fiddle/commit/0ffcaa39e5
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3780
Diffstat (limited to 'ext/fiddle/fiddle.c')
-rw-r--r-- | ext/fiddle/fiddle.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c index 8fb20e8ce2..be287e6fdb 100644 --- a/ext/fiddle/fiddle.c +++ b/ext/fiddle/fiddle.c @@ -235,6 +235,12 @@ Init_fiddle(void) rb_define_const(mFiddle, "TYPE_VARIADIC", INT2NUM(TYPE_VARIADIC)); #endif + /* Document-const: TYPE_CONST_STRING + * + * C type - const char* ('\0' terminated const char*) + */ + rb_define_const(mFiddle, "TYPE_CONST_STRING", INT2NUM(TYPE_CONST_STRING)); + /* Document-const: TYPE_SIZE_T * * C type - size_t @@ -435,6 +441,12 @@ Init_fiddle(void) */ rb_define_const(mFiddle, "SIZEOF_UINTPTR_T", INT2NUM(sizeof(uintptr_t))); + /* Document-const: SIZEOF_CONST_STRING + * + * size of a const char* + */ + rb_define_const(mFiddle, "SIZEOF_CONST_STRING", INT2NUM(sizeof(const char*))); + /* Document-const: RUBY_FREE * * Address of the ruby_xfree() function |