mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* eval_error.c (error_print): use RB_TYPE_P instead of TYPE.
* error.c (rb_check_backtrace): ditto. * error.c (name_err_mesg_to_str): compare immediate values directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									723bfaba59
								
							
						
					
					
						commit
						24476c0c0b
					
				
					 2 changed files with 8 additions and 10 deletions
				
			
		
							
								
								
									
										16
									
								
								error.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								error.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -685,14 +685,12 @@ rb_check_backtrace(VALUE bt)
 | 
			
		|||
    static const char err[] = "backtrace must be Array of String";
 | 
			
		||||
 | 
			
		||||
    if (!NIL_P(bt)) {
 | 
			
		||||
	int t = TYPE(bt);
 | 
			
		||||
 | 
			
		||||
	if (t == T_STRING) return rb_ary_new3(1, bt);
 | 
			
		||||
	if (t != T_ARRAY) {
 | 
			
		||||
	if (RB_TYPE_P(bt, T_STRING)) return rb_ary_new3(1, bt);
 | 
			
		||||
	if (!RB_TYPE_P(bt, T_ARRAY)) {
 | 
			
		||||
	    rb_raise(rb_eTypeError, err);
 | 
			
		||||
	}
 | 
			
		||||
	for (i=0;i<RARRAY_LEN(bt);i++) {
 | 
			
		||||
	    if (TYPE(RARRAY_PTR(bt)[i]) != T_STRING) {
 | 
			
		||||
	    if (!RB_TYPE_P(RARRAY_PTR(bt)[i], T_STRING)) {
 | 
			
		||||
		rb_raise(rb_eTypeError, err);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1045,14 +1043,14 @@ name_err_mesg_to_str(VALUE obj)
 | 
			
		|||
	int state = 0;
 | 
			
		||||
 | 
			
		||||
	obj = ptr[1];
 | 
			
		||||
	switch (TYPE(obj)) {
 | 
			
		||||
	  case T_NIL:
 | 
			
		||||
	switch (obj) {
 | 
			
		||||
	  case Qnil:
 | 
			
		||||
	    desc = "nil";
 | 
			
		||||
	    break;
 | 
			
		||||
	  case T_TRUE:
 | 
			
		||||
	  case Qtrue:
 | 
			
		||||
	    desc = "true";
 | 
			
		||||
	    break;
 | 
			
		||||
	  case T_FALSE:
 | 
			
		||||
	  case Qfalse:
 | 
			
		||||
	    desc = "false";
 | 
			
		||||
	    break;
 | 
			
		||||
	  default:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -168,7 +168,7 @@ error_print(void)
 | 
			
		|||
#define TRACE_TAIL 5
 | 
			
		||||
 | 
			
		||||
	for (i = 1; i < len; i++) {
 | 
			
		||||
	    if (TYPE(ptr[i]) == T_STRING) {
 | 
			
		||||
	    if (RB_TYPE_P(ptr[i], T_STRING)) {
 | 
			
		||||
		warn_printf("\tfrom %s\n", RSTRING_PTR(ptr[i]));
 | 
			
		||||
	    }
 | 
			
		||||
	    if (skip && i == TRACE_HEAD && len > TRACE_MAX) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue