mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* file.c (rb_file_s_basename): pass baselen to rmext.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									793af6993f
								
							
						
					
					
						commit
						b67ecc80df
					
				
					 2 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,7 @@
 | 
			
		|||
Thu Jul 29 05:52:15 2010  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* file.c (rb_file_s_basename): pass baselen to rmext.
 | 
			
		||||
 | 
			
		||||
Thu Jul 29 02:38:09 2010  NARUSE, Yui  <naruse@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* configure.in: not [freebsd] but [freebsd*] for AS_CASE.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										9
									
								
								file.c
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								file.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -3398,15 +3398,12 @@ rb_file_s_realdirpath(int argc, VALUE *argv, VALUE klass)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static size_t
 | 
			
		||||
rmext(const char *p, long l1, const char *e)
 | 
			
		||||
rmext(const char *p, long l0, long l1, const char *e)
 | 
			
		||||
{
 | 
			
		||||
    long l0, l2;
 | 
			
		||||
    long l2;
 | 
			
		||||
 | 
			
		||||
    if (!e) return 0;
 | 
			
		||||
 | 
			
		||||
    for (l0 = 0; l0 < l1; ++l0) {
 | 
			
		||||
	if (p[l0] != '.') break;
 | 
			
		||||
    }
 | 
			
		||||
    l2 = strlen(e);
 | 
			
		||||
    if (l2 == 2 && e[1] == '*') {
 | 
			
		||||
	unsigned char c = *e;
 | 
			
		||||
| 
						 | 
				
			
			@ -3527,7 +3524,7 @@ rb_file_s_basename(int argc, VALUE *argv)
 | 
			
		|||
 | 
			
		||||
    p = ruby_find_basename(name, &f, &n);
 | 
			
		||||
    if (n >= 0) {
 | 
			
		||||
	if (NIL_P(fext) || !(f = rmext(p, n, StringValueCStr(fext)))) {
 | 
			
		||||
	if (NIL_P(fext) || !(f = rmext(p, f, n, StringValueCStr(fext)))) {
 | 
			
		||||
	    f = n;
 | 
			
		||||
	}
 | 
			
		||||
	if (f == RSTRING_LEN(fname)) return rb_str_new_shared(fname);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue