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

* 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
This commit is contained in:
ko1 2008-09-23 01:10:02 +00:00
parent 8cd252ac6f
commit 7440ec27fd
5 changed files with 31 additions and 8 deletions

View file

@ -1,3 +1,10 @@
Tue Sep 23 09:52:07 2008 Koichi Sasada <ko1@atdot.net>
* 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 <ko1@atdot.net>
* common.mk: clean up

View file

@ -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)

3
eval.c
View file

@ -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));

View file

@ -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();

View file

@ -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);
}