From 7440ec27fd23fc725c35049a1aea5bdc4fe9a7b3 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 23 Sep 2008 01:10:02 +0000 Subject: [PATCH] * eval_safe.c, safe.c: rename eval_safe.c to safe.c. * common.mk, eval.c, safe.c, inits.c: separate safe.c from eval.c and make Init_safe(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ common.mk | 4 +++- eval.c | 3 --- inits.c | 2 ++ eval_safe.c => safe.c | 23 +++++++++++++++++++---- 5 files changed, 31 insertions(+), 8 deletions(-) rename eval_safe.c => safe.c (83%) diff --git a/ChangeLog b/ChangeLog index e2ecd26af7..dc5e2a44c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Sep 23 09:52:07 2008 Koichi Sasada + + * eval_safe.c, safe.c: rename eval_safe.c to safe.c. + + * common.mk, eval.c, safe.c, inits.c: separate safe.c from eval.c and + make Init_safe(). + Tue Sep 23 09:20:00 2008 Koichi Sasada * common.mk: clean up diff --git a/common.mk b/common.mk index 0d9e4d4eda..6fa8458b83 100644 --- a/common.mk +++ b/common.mk @@ -60,6 +60,7 @@ COMMONOBJS = array.$(OBJEXT) \ regparse.$(OBJEXT) \ regsyntax.$(OBJEXT) \ ruby.$(OBJEXT) \ + safe.$(OBJEXT) \ signal.$(OBJEXT) \ sprintf.$(OBJEXT) \ st.$(OBJEXT) \ @@ -463,7 +464,7 @@ enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \ error.$(OBJEXT): {$(VPATH)}error.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}eval_intern.h \ $(RUBY_H_INCLUDES) {$(VPATH)}util.h $(VM_CORE_H_INCLUDES) \ - {$(VPATH)}eval_error.c {$(VPATH)}eval_safe.c {$(VPATH)}eval_jump.c + {$(VPATH)}eval_error.c {$(VPATH)}eval_jump.c load.$(OBJEXT): {$(VPATH)}load.c {$(VPATH)}eval_intern.h \ {$(VPATH)}util.h $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \ @@ -514,6 +515,7 @@ regsyntax.$(OBJEXT): {$(VPATH)}regsyntax.c {$(VPATH)}regint.h \ ruby.$(OBJEXT): {$(VPATH)}ruby.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \ $(ENCODING_H_INCLDUES) {$(VPATH)}eval_intern.h \ $(VM_CORE_H_INCLUDES) {$(VPATH)}dln.h +safe.$(OBJEXT): {$(VPATH)}safe.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) signal.$(OBJEXT): {$(VPATH)}signal.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) sprintf.$(OBJEXT): {$(VPATH)}sprintf.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \ {$(VPATH)}regex.h {$(VPATH)}vsnprintf.c $(ENCODING_H_INCLDUES) diff --git a/eval.c b/eval.c index 038198c895..e2d7cfcfd9 100644 --- a/eval.c +++ b/eval.c @@ -24,7 +24,6 @@ VALUE rb_eSysStackError; #define exception_error GET_VM()->special_exceptions[ruby_error_reenter] #include "eval_error.c" -#include "eval_safe.c" #include "eval_jump.c" /* initialize ruby */ @@ -1170,8 +1169,6 @@ Init_eval(void) rb_define_global_function("trace_var", rb_f_trace_var, -1); /* in variable.c */ rb_define_global_function("untrace_var", rb_f_untrace_var, -1); /* in variable.c */ - rb_define_virtual_variable("$SAFE", safe_getter, safe_setter); - exception_error = rb_exc_new3(rb_eFatal, rb_obj_freeze(rb_str_new2("exception reentered"))); rb_ivar_set(exception_error, idThrowState, INT2FIX(TAG_FATAL)); diff --git a/inits.c b/inits.c index 457d361a10..99160e8fa9 100644 --- a/inits.c +++ b/inits.c @@ -23,6 +23,7 @@ void Init_Enumerator(void); void Init_Exception(void); void Init_syserr(void); void Init_eval(void); +void Init_safe(void); void Init_load(void); void Init_Proc(void); void Init_File(void); @@ -68,6 +69,7 @@ rb_call_inits() Init_String(); Init_Exception(); Init_eval(); + Init_safe(); Init_jump(); Init_Numeric(); Init_Bignum(); diff --git a/eval_safe.c b/safe.c similarity index 83% rename from eval_safe.c rename to safe.c index 7d0a077880..e351579132 100644 --- a/eval_safe.c +++ b/safe.c @@ -1,7 +1,13 @@ -/* -*-c-*- */ -/* - * This file is included by eval.c - */ +/********************************************************************** + + eval.c - + + $Author$ + created at: Tue Sep 23 09:44:32 JST 2008 + + Copyright (C) 2008 Yukihiro Matsumoto + +**********************************************************************/ /* safe-level: 0 - strings from streams/environment/ARGV are tainted (default) @@ -13,6 +19,9 @@ #define SAFE_LEVEL_MAX 4 +#include "ruby/ruby.h" +#include "vm_core.h" + /* $SAFE accessor */ int @@ -109,3 +118,9 @@ rb_check_safe_str(VALUE x) rb_obj_classname(x)); } } + +void +Init_safe(void) +{ + rb_define_virtual_variable("$SAFE", safe_getter, safe_setter); +}