mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	date_strptime.c: use ALLOCV
* ext/date/date_strptime.c (read_digits): use ALLOCV instead of ALLOCA get rid of stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									c2c81723a4
								
							
						
					
					
						commit
						d1496e8b8c
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -103,10 +103,12 @@ read_digits(const char *s, VALUE *n, size_t width)
 | 
			
		|||
	return l;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	char *s2 = ALLOCA_N(char, l + 1);
 | 
			
		||||
	VALUE vbuf = 0;
 | 
			
		||||
	char *s2 = ALLOCV_N(char, vbuf, l + 1);
 | 
			
		||||
	memcpy(s2, s, l);
 | 
			
		||||
	s2[l] = '\0';
 | 
			
		||||
	*n = rb_cstr_to_inum(s2, 10, 0);
 | 
			
		||||
	ALLOCV_END(vbuf);
 | 
			
		||||
	return l;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue