diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-31 19:16:48 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-31 19:16:48 +0900 |
| commit | 326fc888e4d1a3a9b0f1dcbad13094cf8f4fe1e3 (patch) | |
| tree | 8172380c8de91059bacc5142f64560d9ddb686c5 /include | |
| parent | 71a480fb536f8a3d67550a6d5f23151332eb48e8 (diff) | |
| download | mruby-326fc888e4d1a3a9b0f1dcbad13094cf8f4fe1e3.tar.gz mruby-326fc888e4d1a3a9b0f1dcbad13094cf8f4fe1e3.zip | |
allow string shared body
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/string.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/mruby/string.h b/include/mruby/string.h index fca28cf72..df1305a79 100644 --- a/include/mruby/string.h +++ b/include/mruby/string.h @@ -30,7 +30,10 @@ extern const char mrb_digitmap[]; struct RString { MRUBY_OBJECT_HEADER; int len; - int capa; + union { + int capa; + struct RString *shared; + } aux; char *buf; }; @@ -38,7 +41,7 @@ struct RString { #define RSTRING(s) ((struct RString*)((s).value.p)) #define RSTRING_PTR(s) (RSTRING(s)->buf) #define RSTRING_LEN(s) (RSTRING(s)->len) -#define RSTRING_CAPA(s) (RSTRING(s)->capa) +#define RSTRING_CAPA(s) (RSTRING(s)->aux.capa) #define RSTRING_END(s) (RSTRING(s)->buf + RSTRING(s)->len) #define MRB_STR_SHARED 256 @@ -64,7 +67,6 @@ mrb_value str_buf_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len char *mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr); char *mrb_string_value_ptr(mrb_state *mrb, mrb_value ptr); -mrb_value mrb_str_subseq(mrb_state *mrb, mrb_value str, long beg, long len); size_t mrb_str_sublen(mrb_state *mrb, mrb_value str, long pos); mrb_value mrb_str_size(mrb_state *mrb, mrb_value self); long mrb_str_offset(mrb_state *mrb, mrb_value str, long pos); |
