Skip to content
Permalink
Browse files
rename prefix RBASIC_ to MRB_; ref #3340
  • Loading branch information
matz committed Dec 11, 2016
1 parent 1fbad32 commit 92c843dd07211d698a6dac90fbd740e483ae34af
Showing 5 changed files with 10 additions and 10 deletions.
@@ -22,9 +22,9 @@ struct RBasic {
};
#define mrb_basic_ptr(v) ((struct RBasic*)(mrb_ptr(v)))

#define RBASIC_FROZEN_P(o) ((o)->flags & MRB_FLAG_IS_FROZEN)
#define RBASIC_SET_FROZEN_FLAG(o) ((o)->flags |= MRB_FLAG_IS_FROZEN)
#define RBASIC_UNSET_FROZEN_FLAG(o) ((o)->flags &= ~MRB_FLAG_IS_FROZEN)
#define MRB_FROZEN_P(o) ((o)->flags & MRB_FLAG_IS_FROZEN)
#define MRB_SET_FROZEN_FLAG(o) ((o)->flags |= MRB_FLAG_IS_FROZEN)
#define MRB_UNSET_FROZEN_FLAG(o) ((o)->flags &= ~MRB_FLAG_IS_FROZEN)

struct RObject {
MRB_OBJECT_HEADER;
@@ -108,7 +108,7 @@ ary_fill_with_nil(mrb_value *ptr, mrb_int size)
static void
ary_modify(mrb_state *mrb, struct RArray *a)
{
if (RBASIC_FROZEN_P(a)) {
if (MRB_FROZEN_P(a)) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't modify frozen array");
}

@@ -98,9 +98,9 @@ static void mrb_hash_modify(mrb_state *mrb, mrb_value hash);
static inline mrb_value
mrb_hash_ht_key(mrb_state *mrb, mrb_value key)
{
if (mrb_string_p(key) && !RBASIC_FROZEN_P(mrb_str_ptr(key))) {
if (mrb_string_p(key) && !MRB_FROZEN_P(mrb_str_ptr(key))) {
key = mrb_str_dup(mrb, key);
RBASIC_SET_FROZEN_FLAG(mrb_str_ptr(key));
MRB_SET_FROZEN_FLAG(mrb_str_ptr(key));
}
return key;
}
@@ -278,7 +278,7 @@ mrb_hash_tbl(mrb_state *mrb, mrb_value hash)
static void
mrb_hash_modify(mrb_state *mrb, mrb_value hash)
{
if (RBASIC_FROZEN_P(mrb_hash_ptr(hash))) {
if (MRB_FROZEN_P(mrb_hash_ptr(hash))) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't modify frozen hash");
}
mrb_hash_tbl(mrb, hash);
@@ -455,7 +455,7 @@ mrb_obj_freeze(mrb_state *mrb, mrb_value self)
{
struct RBasic *b = mrb_basic_ptr(self);

RBASIC_SET_FROZEN_FLAG(b);
MRB_SET_FROZEN_FLAG(b);
return self;
}

@@ -501,7 +501,7 @@ str_index(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int offset)
static void
check_frozen(mrb_state *mrb, struct RString *s)
{
if (RBASIC_FROZEN_P(s)) {
if (MRB_FROZEN_P(s)) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't modify frozen string");
}
}
@@ -2208,7 +2208,7 @@ mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
char *p = RSTR_PTR(ps);

if (!p || p[len] != '\0') {
if (RBASIC_FROZEN_P(ps)) {
if (MRB_FROZEN_P(ps)) {
*ptr = str = mrb_str_dup(mrb, str);
ps = mrb_str_ptr(str);
}

0 comments on commit 92c843d

Please sign in to comment.