diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-28 02:47:22 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-28 02:47:22 +0900 |
| commit | 5c68195c88ed45164373b0ca435a7be2421dcc7c (patch) | |
| tree | c1e56af6ca069a0625ae86a25bc24b8bb409656a /include | |
| parent | 160eb71338205813b9b9c599249b4a5e2bec4217 (diff) | |
| download | mruby-5c68195c88ed45164373b0ca435a7be2421dcc7c.tar.gz mruby-5c68195c88ed45164373b0ca435a7be2421dcc7c.zip | |
mrb_str_new_static(): zero copy string creation
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby.h | 1 | ||||
| -rw-r--r-- | include/mruby/string.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/mruby.h b/include/mruby.h index 8c811c58f..28eea6929 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -231,6 +231,7 @@ void *mrb_free(mrb_state*, void*); mrb_value mrb_str_new(mrb_state *mrb, const char *p, size_t len); mrb_value mrb_str_new_cstr(mrb_state*, const char*); +mrb_value mrb_str_new_static(mrb_state *mrb, const char *p, size_t len); mrb_state* mrb_open(void); mrb_state* mrb_open_allocf(mrb_allocf, void *ud); diff --git a/include/mruby/string.h b/include/mruby/string.h index c62d79563..a1b38d039 100644 --- a/include/mruby/string.h +++ b/include/mruby/string.h @@ -37,7 +37,8 @@ struct RString { #define RSTRING_LEN(s) (RSTRING(s)->len) #define RSTRING_CAPA(s) (RSTRING(s)->aux.capa) #define RSTRING_END(s) (RSTRING(s)->ptr + RSTRING(s)->len) -#define MRB_STR_SHARED 256 +#define MRB_STR_SHARED 1 +#define MRB_STR_STATIC (1<<1) void mrb_str_decref(mrb_state*, mrb_shared_string*); void mrb_str_modify(mrb_state*, struct RString*); |
