Skip to content

Commit

Permalink
rename prefix RBASIC_ to MRB_; ref #3340
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Dec 11, 2016
1 parent 1fbad32 commit 92c843d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions include/mruby/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
6 changes: 3 additions & 3 deletions src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 92c843d

Please sign in to comment.