summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-08-20 09:26:46 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-08-20 09:26:46 +0900
commitf6f31a8ecd7e8f9f9830f050842e11d2aaef94a1 (patch)
tree06e27db80de6b6b5201c6d60c8ef5e21e034f44b
parent1251b0d5c997009d328046e037f44530167a9e4d (diff)
parentae306793f231309c12661b111535de6613d5a774 (diff)
downloadmruby-f6f31a8ecd7e8f9f9830f050842e11d2aaef94a1.tar.gz
mruby-f6f31a8ecd7e8f9f9830f050842e11d2aaef94a1.zip
Merge pull request #2545 from cubicdaiya/issues/use_null_insteadof_zero
Use specified macro(NULL) instead of magic-number.
-rw-r--r--src/class.c6
-rw-r--r--src/codegen.c2
-rw-r--r--src/parse.y8
3 files changed, 8 insertions, 8 deletions
diff --git a/src/class.c b/src/class.c
index 5ea1f329f..2fa02fa87 100644
--- a/src/class.c
+++ b/src/class.c
@@ -128,7 +128,7 @@ mrb_class_outer_module(mrb_state *mrb, struct RClass *c)
mrb_value outer;
outer = mrb_obj_iv_get(mrb, (struct RObject*)c, mrb_intern_lit(mrb, "__outer__"));
- if (mrb_nil_p(outer)) return 0;
+ if (mrb_nil_p(outer)) return NULL;
return mrb_class_ptr(outer);
}
@@ -1030,7 +1030,7 @@ mrb_method_search_vm(mrb_state *mrb, struct RClass **cp, mrb_sym mid)
}
c = c->super;
}
- return 0; /* no method */
+ return NULL; /* no method */
}
MRB_API struct RProc*
@@ -1295,7 +1295,7 @@ MRB_API struct RClass *
mrb_class_real(struct RClass* cl)
{
if (cl == 0)
- return 0;
+ return NULL;
while ((cl->tt == MRB_TT_SCLASS) || (cl->tt == MRB_TT_ICLASS)) {
cl = cl->super;
}
diff --git a/src/codegen.c b/src/codegen.c
index 7ff911758..268ecf1e8 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -2470,7 +2470,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
mrb_pool *pool = mrb_pool_open(mrb);
codegen_scope *p = (codegen_scope *)mrb_pool_alloc(pool, sizeof(codegen_scope));
- if (!p) return 0;
+ if (!p) return NULL;
*p = codegen_scope_zero;
p->mrb = mrb;
p->mpool = pool;
diff --git a/src/parse.y b/src/parse.y
index 633d92ad3..03333e808 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -5365,9 +5365,9 @@ mrb_parser_new(mrb_state *mrb)
static const parser_state parser_state_zero = { 0 };
pool = mrb_pool_open(mrb);
- if (!pool) return 0;
+ if (!pool) return NULL;
p = (parser_state *)mrb_pool_alloc(pool, sizeof(parser_state));
- if (!p) return 0;
+ if (!p) return NULL;
*p = parser_state_zero;
p->mrb = mrb;
@@ -5483,7 +5483,7 @@ mrb_parse_file(mrb_state *mrb, FILE *f, mrbc_context *c)
parser_state *p;
p = mrb_parser_new(mrb);
- if (!p) return 0;
+ if (!p) return NULL;
p->s = p->send = NULL;
p->f = f;
@@ -5498,7 +5498,7 @@ mrb_parse_nstring(mrb_state *mrb, const char *s, int len, mrbc_context *c)
parser_state *p;
p = mrb_parser_new(mrb);
- if (!p) return 0;
+ if (!p) return NULL;
p->s = s;
p->send = s + len;