mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Add warning for str_new_static functions
Many functions in string.c assume that capa + termlen to be readable memory. Add comment in header to communicate this to extension authors. See also: comment in str_fill_term()
This commit is contained in:
		
							parent
							
								
									520b86caf1
								
							
						
					
					
						commit
						670e288d65
					
				
				
				Notes:
				
					git
				
				2020-10-31 08:47:40 +09:00 
				
			
			
			
		
		
					 1 changed files with 8 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -66,9 +66,14 @@ VALUE rb_usascii_str_new(const char*, long);
 | 
			
		|||
VALUE rb_usascii_str_new_cstr(const char*);
 | 
			
		||||
VALUE rb_utf8_str_new(const char*, long);
 | 
			
		||||
VALUE rb_utf8_str_new_cstr(const char*);
 | 
			
		||||
VALUE rb_str_new_static(const char *, long);
 | 
			
		||||
VALUE rb_usascii_str_new_static(const char *, long);
 | 
			
		||||
VALUE rb_utf8_str_new_static(const char *, long);
 | 
			
		||||
/**
 | 
			
		||||
 *  *_str_new_static functions are intended for C string literals.
 | 
			
		||||
 *  They require memory in the range [ptr, ptr+len] to always be readable.
 | 
			
		||||
 *  Note that this range covers a total of len + 1 bytes.
 | 
			
		||||
 */
 | 
			
		||||
VALUE rb_str_new_static(const char *ptr, long len);
 | 
			
		||||
VALUE rb_usascii_str_new_static(const char *ptr, long len);
 | 
			
		||||
VALUE rb_utf8_str_new_static(const char *ptr, long len);
 | 
			
		||||
void rb_str_free(VALUE);
 | 
			
		||||
void rb_str_shared_replace(VALUE, VALUE);
 | 
			
		||||
VALUE rb_str_buf_append(VALUE, VALUE);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue