mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* file.c (rb_get_path_check): prefer #to_path over #to_str. a patch
originally written by me, and modified by Nobuyoshi Nakada. [ruby-core:24257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									9c15f6f822
								
							
						
					
					
						commit
						e70499732a
					
				
					 2 changed files with 9 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,9 @@
 | 
			
		|||
Thu Mar 25 23:17:16 2010  Yusuke Endoh  <mame@tsg.ne.jp>
 | 
			
		||||
 | 
			
		||||
	* file.c (rb_get_path_check): prefer #to_path over #to_str.  a patch
 | 
			
		||||
	  originally written by me, and modified by Nobuyoshi Nakada.
 | 
			
		||||
	  [ruby-core:24257]
 | 
			
		||||
 | 
			
		||||
Thu Mar 25 18:10:08 2010  Kazuhiro NISHIYAMA  <zn@mbf.nifty.com>
 | 
			
		||||
 | 
			
		||||
	* NEWS: Array#{uniq,uniq!} can take a block. see [ruby-dev:37998]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								file.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								file.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -129,18 +129,14 @@ rb_get_path_check(VALUE obj, int level)
 | 
			
		|||
    if (insecure_obj_p(obj, level)) {
 | 
			
		||||
	rb_insecure_operation();
 | 
			
		||||
    }
 | 
			
		||||
    tmp = rb_check_string_type(obj);
 | 
			
		||||
    if (!NIL_P(tmp)) goto exit;
 | 
			
		||||
 | 
			
		||||
    CONST_ID(to_path, "to_path");
 | 
			
		||||
    if (rb_respond_to(obj, to_path)) {
 | 
			
		||||
	tmp = rb_funcall(obj, to_path, 0, 0);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
    tmp = rb_check_funcall(obj, to_path, 0, 0);
 | 
			
		||||
    if (tmp == Qundef) {
 | 
			
		||||
	tmp = obj;
 | 
			
		||||
    }
 | 
			
		||||
    StringValue(tmp);
 | 
			
		||||
  exit:
 | 
			
		||||
 | 
			
		||||
    tmp = file_path_convert(tmp);
 | 
			
		||||
    StringValueCStr(tmp);
 | 
			
		||||
    if (obj != tmp && insecure_obj_p(tmp, level)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue