1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

rb_enc_left_char_head(): take void*

Nobu doesn't like (char*) cast.
This commit is contained in:
卜部昌平 2021-10-05 11:39:05 +09:00
parent 499660b04f
commit f032c09bca
Notes: git 2021-10-05 14:18:46 +09:00
2 changed files with 2 additions and 2 deletions

View file

@ -694,7 +694,7 @@ rb_enc_prev_char(const char *s, const char *p, const char *e, const rb_encoding
* @return Pointer to the head of the character that contains `p`. * @return Pointer to the head of the character that contains `p`.
*/ */
static inline char * static inline char *
rb_enc_left_char_head(const char *s, const char *p, const char *e, const rb_encoding *enc) rb_enc_left_char_head(const char *s, const void *p, const char *e, const rb_encoding *enc)
{ {
const OnigUChar *us = RBIMPL_CAST((const OnigUChar *)s); const OnigUChar *us = RBIMPL_CAST((const OnigUChar *)s);
const OnigUChar *up = RBIMPL_CAST((const OnigUChar *)p); const OnigUChar *up = RBIMPL_CAST((const OnigUChar *)p);

View file

@ -5738,7 +5738,7 @@ rb_str_setbyte(VALUE str, VALUE index, VALUE value)
ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID); ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID);
goto end; goto end;
case ENC_CODERANGE_VALID: case ENC_CODERANGE_VALID:
left = rb_enc_left_char_head(head, (char *)ptr, head+len, enc); left = rb_enc_left_char_head(head, ptr, head+len, enc);
width = rb_enc_precise_mbclen(left, head+len, enc); width = rb_enc_precise_mbclen(left, head+len, enc);
*ptr = byte; *ptr = byte;
nlen = rb_enc_precise_mbclen(left, head+len, enc); nlen = rb_enc_precise_mbclen(left, head+len, enc);