1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

load.c: use TAG_RETURN

* load.c (rb_require_internal): use TAG_RETURN not a magic number.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-07-18 14:47:11 +00:00
parent 22f75c300d
commit f10eb2c363

9
load.c
View file

@ -1007,7 +1007,7 @@ rb_require_internal(VALUE fname, int safe)
} }
else if (!*ftptr) { else if (!*ftptr) {
rb_provide_feature(path); rb_provide_feature(path);
result = 1; result = TAG_RETURN;
} }
else { else {
switch (found) { switch (found) {
@ -1022,7 +1022,7 @@ rb_require_internal(VALUE fname, int safe)
break; break;
} }
rb_provide_feature(path); rb_provide_feature(path);
result = 1; result = TAG_RETURN;
} }
} }
} }
@ -1052,9 +1052,8 @@ ruby_require_internal(const char *fname, unsigned int len)
struct RString fake; struct RString fake;
VALUE str = rb_setup_fake_str(&fake, fname, len, 0); VALUE str = rb_setup_fake_str(&fake, fname, len, 0);
int result = rb_require_internal(str, 0); int result = rb_require_internal(str, 0);
if (result > 1) result = -1;
rb_set_errinfo(Qnil); rb_set_errinfo(Qnil);
return result; return result == TAG_RETURN ? 1 : result ? -1 : 0;
} }
VALUE VALUE
@ -1062,7 +1061,7 @@ rb_require_safe(VALUE fname, int safe)
{ {
int result = rb_require_internal(fname, safe); int result = rb_require_internal(fname, safe);
if (result > 1) { if (result > TAG_RETURN) {
JUMP_TAG(result); JUMP_TAG(result);
} }
if (result < 0) { if (result < 0) {