* eval.c (proc_save_safe_level, proc_get_safe_level,

proc_set_safe_level): save/restore safe level 1..4.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-10-09 08:43:39 +00:00
Родитель 0b2e94b2ab
Коммит dd3eed4f08
2 изменённых файлов: 10 добавлений и 34 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Oct 9 17:43:36 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (proc_save_safe_level, proc_get_safe_level,
proc_set_safe_level): save/restore safe level 1..4.
Thu Oct 9 15:45:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* pack.c (uv_to_utf8): change message to "out of range", since

39
eval.c
Просмотреть файл

@ -6866,57 +6866,28 @@ rb_f_binding(self)
return bind;
}
#define PROC_T3 FL_USER1
#define PROC_T4 FL_USER2
#define PROC_TMAX (FL_USER1|FL_USER2)
#define PROC_TMASK (FL_USER1|FL_USER2)
#define PROC_TSHIFT (FL_USHIFT+1)
#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3)
static void
proc_save_safe_level(data)
VALUE data;
{
if (OBJ_TAINTED(data)) {
switch (ruby_safe_level) {
case 3:
FL_SET(data, PROC_T3);
break;
case 4:
FL_SET(data, PROC_T4);
break;
default:
if (ruby_safe_level > 4) {
FL_SET(data, PROC_TMAX);
}
break;
}
}
FL_SET(data, (ruby_safe_level << PROC_TSHIFT) & PROC_TMASK);
}
static int
proc_get_safe_level(data)
VALUE data;
{
if (OBJ_TAINTED(data)) {
switch (RBASIC(data)->flags & PROC_TMASK) {
case PROC_T3:
return 3;
case PROC_T4:
return 4;
case PROC_TMAX:
return 5;
}
return 3;
}
return 0;
return (RBASIC(data)->flags & PROC_TMASK) >> PROC_TSHIFT;
}
static void
proc_set_safe_level(data)
VALUE data;
{
if (OBJ_TAINTED(data)) {
ruby_safe_level = proc_get_safe_level(data);
}
ruby_safe_level = proc_get_safe_level(data);
}
static VALUE