rb_strlen_lit: support wide string literals
This commit is contained in:
parent
2f88a9258d
commit
bce1bd1dc1
Notes:
git
2024-11-10 14:27:40 +00:00
@ -1689,7 +1689,7 @@ rbimpl_exc_new_cstr(VALUE exc, const char *str)
|
|||||||
* @return An integer constant expression that represents `str`'s length,
|
* @return An integer constant expression that represents `str`'s length,
|
||||||
* in bytes, not including the terminating NUL character.
|
* in bytes, not including the terminating NUL character.
|
||||||
*/
|
*/
|
||||||
#define rb_strlen_lit(str) (sizeof(str "") - 1)
|
#define rb_strlen_lit(str) ((sizeof(str "") / sizeof(str ""[0])) - 1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identical to rb_str_new_static(), except it cannot take string variables.
|
* Identical to rb_str_new_static(), except it cannot take string variables.
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# define FALSE 0
|
# define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
|
#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
|
||||||
#define rb_strlen_lit(str) (sizeof(str "") - 1)
|
#define rb_strlen_lit(str) ((sizeof(str "") / sizeof(str ""[0])) - 1)
|
||||||
#undef FIXNUM_MAX
|
#undef FIXNUM_MAX
|
||||||
#define FIXNUM_MAX (LONG_MAX / 2)
|
#define FIXNUM_MAX (LONG_MAX / 2)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user