diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-07-17 00:29:33 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-07-17 10:36:10 +0900 |
| commit | b22bde6596ece6f9e3ef245bbab13a9f664907a8 (patch) | |
| tree | 5bed2c88a963ee1ef485246ed17d073cc2fc32fc | |
| parent | 2add8641648e00717c97b730be8762aece80029e (diff) | |
| download | mruby-b22bde6596ece6f9e3ef245bbab13a9f664907a8.tar.gz mruby-b22bde6596ece6f9e3ef245bbab13a9f664907a8.zip | |
Avoid `MRB_INLINE` for `mrb_str_modify()`; ref #4579
Functions that are called infrequently need not to be inline.
| -rw-r--r-- | include/mruby/string.h | 9 | ||||
| -rw-r--r-- | src/string.c | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/include/mruby/string.h b/include/mruby/string.h index 77f6becf6..d17ac1c1d 100644 --- a/include/mruby/string.h +++ b/include/mruby/string.h @@ -108,6 +108,8 @@ MRB_API mrb_int mrb_str_strlen(mrb_state*, struct RString*); void mrb_gc_free_str(mrb_state*, struct RString*); +MRB_API void mrb_str_modify(mrb_state *mrb, struct RString *s); +/* mrb_str_modify() with keeping ASCII flag if set */ MRB_API void mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s); /* @@ -456,13 +458,6 @@ mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str); mrb_bool mrb_str_beg_len(mrb_int str_len, mrb_int *begp, mrb_int *lenp); mrb_value mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len); -MRB_INLINE void -mrb_str_modify(mrb_state *mrb, struct RString *s) -{ - mrb_str_modify_keep_ascii(mrb, s); - RSTR_UNSET_ASCII_FLAG(s); -} - #ifdef MRB_UTF8_STRING mrb_int mrb_utf8_len(const char *str, mrb_int byte_len); #endif diff --git a/src/string.c b/src/string.c index 6b7cced13..de8a15ba9 100644 --- a/src/string.c +++ b/src/string.c @@ -770,6 +770,13 @@ mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s) } } +MRB_API void +mrb_str_modify(mrb_state *mrb, struct RString *s) +{ + mrb_str_modify_keep_ascii(mrb, s); + RSTR_UNSET_ASCII_FLAG(s); +} + MRB_API mrb_value mrb_str_resize(mrb_state *mrb, mrb_value str, mrb_int len) { |
