summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-08-27 17:54:30 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-08-27 17:54:30 +0900
commit1a45447b8b66159a4a7d0348c4a01a175b3778fd (patch)
tree938ca06713b6833805a9f47b53ef8cf5e5470748 /include
parent87e11676b3a49d0dc3758c899deeab820d744b36 (diff)
downloadmruby-1a45447b8b66159a4a7d0348c4a01a175b3778fd.tar.gz
mruby-1a45447b8b66159a4a7d0348c4a01a175b3778fd.zip
add String#freeze to the core
Diffstat (limited to 'include')
-rw-r--r--include/mruby/string.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/mruby/string.h b/include/mruby/string.h
index 5228dcbca..c4b31216e 100644
--- a/include/mruby/string.h
+++ b/include/mruby/string.h
@@ -59,6 +59,10 @@ struct RString {
#define RSTR_SET_NOFREE_FLAG(s) ((s)->flags |= MRB_STR_NOFREE)
#define RSTR_UNSET_NOFREE_FLAG(s) ((s)->flags &= ~MRB_STR_NOFREE)
+#define RSTR_FROZEN_P(s) ((s)->flags & MRB_STR_FROZEN)
+#define RSTR_SET_FROZEN_FLAG(s) ((s)->flags |= MRB_STR_FROZEN)
+#define RSTR_UNSET_FROZEN_FLAG(s) ((s)->flags &= ~MRB_STR_FROZEN)
+
#define mrb_str_ptr(s) ((struct RString*)(mrb_ptr(s)))
#define RSTRING(s) mrb_str_ptr(s)
#define RSTRING_PTR(s) RSTR_PTR(RSTRING(s))
@@ -70,9 +74,10 @@ mrb_int mrb_str_strlen(mrb_state*, struct RString*);
#define MRB_STR_SHARED 1
#define MRB_STR_NOFREE 2
-#define MRB_STR_EMBED 4
-#define MRB_STR_EMBED_LEN_MASK 0xf8
-#define MRB_STR_EMBED_LEN_SHIFT 3
+#define MRB_STR_FROZEN 4
+#define MRB_STR_EMBED 8
+#define MRB_STR_EMBED_LEN_MASK 0x1f0
+#define MRB_STR_EMBED_LEN_SHIFT 4
void mrb_gc_free_str(mrb_state*, struct RString*);
MRB_API void mrb_str_modify(mrb_state*, struct RString*);