mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	encoding.h: constify rb_encoding
* include/ruby/encoding.h: constify `rb_encoding` itself, not only arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									b875b4a6d9
								
							
						
					
					
						commit
						f2980e3e20
					
				
					 11 changed files with 158 additions and 155 deletions
				
			
		
							
								
								
									
										8
									
								
								dir.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								dir.c
									
										
									
									
									
								
							|  | @ -1307,17 +1307,17 @@ struct glob_args { | |||
|     rb_encoding *enc; | ||||
| }; | ||||
| 
 | ||||
| #define glob_call_func(func, path, arg, enc) (*(func))((path), (arg), (void *)(enc)) | ||||
| 
 | ||||
| static VALUE | ||||
| glob_func_caller(VALUE val) | ||||
| { | ||||
|     struct glob_args *args = (struct glob_args *)val; | ||||
| 
 | ||||
|     (*args->func)(args->path, args->value, args->enc); | ||||
|     glob_call_func(args->func, args->path, args->value, args->enc); | ||||
|     return Qnil; | ||||
| } | ||||
| 
 | ||||
| #define glob_call_func(func, path, arg, enc) (*(func))((path), (arg), (enc)) | ||||
| 
 | ||||
| static int | ||||
| glob_helper( | ||||
|     const char *path, | ||||
|  | @ -1724,7 +1724,7 @@ ruby_brace_expand(const char *str, int flags, ruby_glob_func *func, VALUE arg, | |||
| 	GLOB_FREE(buf); | ||||
|     } | ||||
|     else if (!lbrace && !rbrace) { | ||||
| 	status = (*func)(s, arg, enc); | ||||
| 	status = glob_call_func(func, s, arg, enc); | ||||
|     } | ||||
| 
 | ||||
|     return status; | ||||
|  |  | |||
							
								
								
									
										67
									
								
								encoding.c
									
										
									
									
									
								
							
							
						
						
									
										67
									
								
								encoding.c
									
										
									
									
									
								
							|  | @ -20,9 +20,11 @@ | |||
| #undef rb_utf8_encindex | ||||
| #undef rb_usascii_encindex | ||||
| 
 | ||||
| typedef OnigEncodingType rb_raw_encoding; | ||||
| 
 | ||||
| #if defined __GNUC__ && __GNUC__ >= 4 | ||||
| #pragma GCC visibility push(default) | ||||
| int rb_enc_register(const char *name, const rb_encoding *encoding); | ||||
| int rb_enc_register(const char *name, rb_encoding *encoding); | ||||
| void rb_enc_set_base(const char *name, const char *orig); | ||||
| int rb_enc_set_dummy(int index); | ||||
| void rb_encdb_declare(const char *name); | ||||
|  | @ -80,7 +82,7 @@ static const rb_data_type_t encoding_data_type = { | |||
| static VALUE | ||||
| enc_new(rb_encoding *encoding) | ||||
| { | ||||
|     return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, encoding); | ||||
|     return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, (void *)encoding); | ||||
| } | ||||
| 
 | ||||
| static VALUE | ||||
|  | @ -99,7 +101,7 @@ rb_enc_from_encoding_index(int idx) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_from_encoding(const rb_encoding *encoding) | ||||
| rb_enc_from_encoding(rb_encoding *encoding) | ||||
| { | ||||
|     int idx; | ||||
|     if (!encoding) return Qnil; | ||||
|  | @ -254,10 +256,10 @@ enc_table_expand(int newsize) | |||
| } | ||||
| 
 | ||||
| static int | ||||
| enc_register_at(int index, const char *name, const rb_encoding *base_encoding) | ||||
| enc_register_at(int index, const char *name, rb_encoding *base_encoding) | ||||
| { | ||||
|     struct rb_encoding_entry *ent = &enc_table.list[index]; | ||||
|     rb_encoding *encoding; | ||||
|     rb_raw_encoding *encoding; | ||||
|     VALUE list; | ||||
| 
 | ||||
|     if (!valid_encoding_name_p(name)) return -1; | ||||
|  | @ -267,18 +269,19 @@ enc_register_at(int index, const char *name, const rb_encoding *base_encoding) | |||
|     else if (STRCASECMP(name, ent->name)) { | ||||
| 	return -1; | ||||
|     } | ||||
|     if (!ent->enc) { | ||||
| 	ent->enc = xmalloc(sizeof(rb_encoding)); | ||||
|     encoding = (rb_raw_encoding *)ent->enc; | ||||
|     if (!encoding) { | ||||
| 	encoding = xmalloc(sizeof(rb_encoding)); | ||||
|     } | ||||
|     if (base_encoding) { | ||||
| 	*ent->enc = *base_encoding; | ||||
| 	*encoding = *base_encoding; | ||||
|     } | ||||
|     else { | ||||
| 	memset(ent->enc, 0, sizeof(*ent->enc)); | ||||
| 	memset(encoding, 0, sizeof(*ent->enc)); | ||||
|     } | ||||
|     encoding = ent->enc; | ||||
|     encoding->name = name; | ||||
|     encoding->ruby_encoding_index = index; | ||||
|     ent->enc = encoding; | ||||
|     st_insert(enc_table.names, (st_data_t)name, (st_data_t)index); | ||||
|     list = rb_encoding_list; | ||||
|     if (list && NIL_P(rb_ary_entry(list, index))) { | ||||
|  | @ -289,7 +292,7 @@ enc_register_at(int index, const char *name, const rb_encoding *base_encoding) | |||
| } | ||||
| 
 | ||||
| static int | ||||
| enc_register(const char *name, const rb_encoding *encoding) | ||||
| enc_register(const char *name, rb_encoding *encoding) | ||||
| { | ||||
|     int index = enc_table.count; | ||||
| 
 | ||||
|  | @ -298,11 +301,11 @@ enc_register(const char *name, const rb_encoding *encoding) | |||
|     return enc_register_at(index - 1, name, encoding); | ||||
| } | ||||
| 
 | ||||
| static void set_encoding_const(const char *, const rb_encoding *); | ||||
| static void set_encoding_const(const char *, rb_encoding *); | ||||
| int rb_enc_registered(const char *name); | ||||
| 
 | ||||
| int | ||||
| rb_enc_register(const char *name, const rb_encoding *encoding) | ||||
| rb_enc_register(const char *name, rb_encoding *encoding) | ||||
| { | ||||
|     int index = rb_enc_registered(name); | ||||
| 
 | ||||
|  | @ -349,7 +352,7 @@ set_base_encoding(int index, rb_encoding *base) | |||
|     rb_encoding *enc = enc_table.list[index].enc; | ||||
| 
 | ||||
|     enc_table.list[index].base = base; | ||||
|     if (rb_enc_dummy_p(base)) ENC_SET_DUMMY(enc); | ||||
|     if (rb_enc_dummy_p(base)) ENC_SET_DUMMY((rb_raw_encoding *)enc); | ||||
|     return enc; | ||||
| } | ||||
| 
 | ||||
|  | @ -373,7 +376,7 @@ rb_enc_set_dummy(int index) | |||
| { | ||||
|     rb_encoding *enc = enc_table.list[index].enc; | ||||
| 
 | ||||
|     ENC_SET_DUMMY(enc); | ||||
|     ENC_SET_DUMMY((rb_raw_encoding *)enc); | ||||
|     return index; | ||||
| } | ||||
| 
 | ||||
|  | @ -440,7 +443,7 @@ rb_define_dummy_encoding(const char *name) | |||
|     int index = rb_enc_replicate(name, rb_ascii8bit_encoding()); | ||||
|     rb_encoding *enc = enc_table.list[index].enc; | ||||
| 
 | ||||
|     ENC_SET_DUMMY(enc); | ||||
|     ENC_SET_DUMMY((rb_raw_encoding *)enc); | ||||
|     return index; | ||||
| } | ||||
| 
 | ||||
|  | @ -451,7 +454,7 @@ rb_encdb_dummy(const char *name) | |||
| 					 rb_enc_registered(name)); | ||||
|     rb_encoding *enc = enc_table.list[index].enc; | ||||
| 
 | ||||
|     ENC_SET_DUMMY(enc); | ||||
|     ENC_SET_DUMMY((rb_raw_encoding *)enc); | ||||
|     return index; | ||||
| } | ||||
| 
 | ||||
|  | @ -494,7 +497,7 @@ enc_ascii_compatible_p(VALUE enc) | |||
|  * Returns 1 when the encoding is Unicode series other than UTF-7 else 0. | ||||
|  */ | ||||
| int | ||||
| rb_enc_unicode_p(const rb_encoding *enc) | ||||
| rb_enc_unicode_p(rb_encoding *enc) | ||||
| { | ||||
|     return ONIGENC_IS_UNICODE(enc); | ||||
| } | ||||
|  | @ -554,7 +557,7 @@ rb_encdb_alias(const char *alias, const char *orig) | |||
| void | ||||
| rb_encdb_set_unicode(int index) | ||||
| { | ||||
|     rb_enc_from_index(index)->flags |= ONIGENC_FLAG_UNICODE; | ||||
|     ((rb_raw_encoding *)rb_enc_from_index(index))->flags |= ONIGENC_FLAG_UNICODE; | ||||
| } | ||||
| 
 | ||||
| extern rb_encoding OnigEncodingUTF_8; | ||||
|  | @ -672,7 +675,7 @@ enc_autoload(rb_encoding *enc) | |||
| 	} | ||||
| 	i = enc->ruby_encoding_index; | ||||
| 	enc_register_at(i & ENC_INDEX_MASK, rb_enc_name(enc), base); | ||||
| 	enc->ruby_encoding_index = i; | ||||
| 	((rb_raw_encoding *)enc)->ruby_encoding_index = i; | ||||
|     } | ||||
|     else { | ||||
| 	i = load_encoding(rb_enc_name(enc)); | ||||
|  | @ -825,7 +828,7 @@ rb_enc_associate_index(VALUE obj, int idx) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_associate(VALUE obj, const rb_encoding *enc) | ||||
| rb_enc_associate(VALUE obj, rb_encoding *enc) | ||||
| { | ||||
|     return rb_enc_associate_index(obj, rb_enc_to_index(enc)); | ||||
| } | ||||
|  | @ -939,13 +942,13 @@ rb_obj_encoding(VALUE obj) | |||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_fast_mbclen(const char *p, const char *e, const rb_encoding *enc) | ||||
| rb_enc_fast_mbclen(const char *p, const char *e, rb_encoding *enc) | ||||
| { | ||||
|     return ONIGENC_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e); | ||||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_mbclen(const char *p, const char *e, const rb_encoding *enc) | ||||
| rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc) | ||||
| { | ||||
|     int n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e); | ||||
|     if (MBCLEN_CHARFOUND_P(n) && MBCLEN_CHARFOUND_LEN(n) <= e-p) | ||||
|  | @ -957,7 +960,7 @@ rb_enc_mbclen(const char *p, const char *e, const rb_encoding *enc) | |||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_precise_mbclen(const char *p, const char *e, const rb_encoding *enc) | ||||
| rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc) | ||||
| { | ||||
|     int n; | ||||
|     if (e <= p) | ||||
|  | @ -969,7 +972,7 @@ rb_enc_precise_mbclen(const char *p, const char *e, const rb_encoding *enc) | |||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_ascget(const char *p, const char *e, int *len, const rb_encoding *enc) | ||||
| rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc) | ||||
| { | ||||
|     unsigned int c, l; | ||||
|     if (e <= p) | ||||
|  | @ -992,7 +995,7 @@ rb_enc_ascget(const char *p, const char *e, int *len, const rb_encoding *enc) | |||
| } | ||||
| 
 | ||||
| unsigned int | ||||
| rb_enc_codepoint_len(const char *p, const char *e, int *len_p, const rb_encoding *enc) | ||||
| rb_enc_codepoint_len(const char *p, const char *e, int *len_p, rb_encoding *enc) | ||||
| { | ||||
|     int r; | ||||
|     if (e <= p) | ||||
|  | @ -1007,13 +1010,13 @@ rb_enc_codepoint_len(const char *p, const char *e, int *len_p, const rb_encoding | |||
| 
 | ||||
| #undef rb_enc_codepoint | ||||
| unsigned int | ||||
| rb_enc_codepoint(const char *p, const char *e, const rb_encoding *enc) | ||||
| rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc) | ||||
| { | ||||
|     return rb_enc_codepoint_len(p, e, 0, enc); | ||||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_codelen(int c, const rb_encoding *enc) | ||||
| rb_enc_codelen(int c, rb_encoding *enc) | ||||
| { | ||||
|     int n = ONIGENC_CODE_TO_MBCLEN(enc,c); | ||||
|     if (n == 0) { | ||||
|  | @ -1024,19 +1027,19 @@ rb_enc_codelen(int c, const rb_encoding *enc) | |||
| 
 | ||||
| #undef rb_enc_code_to_mbclen | ||||
| int | ||||
| rb_enc_code_to_mbclen(int code, const rb_encoding *enc) | ||||
| rb_enc_code_to_mbclen(int code, rb_encoding *enc) | ||||
| { | ||||
|     return ONIGENC_CODE_TO_MBCLEN(enc, code); | ||||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_toupper(int c, const rb_encoding *enc) | ||||
| rb_enc_toupper(int c, rb_encoding *enc) | ||||
| { | ||||
|     return (ONIGENC_IS_ASCII_CODE(c)?ONIGENC_ASCII_CODE_TO_UPPER_CASE(c):(c)); | ||||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_tolower(int c, const rb_encoding *enc) | ||||
| rb_enc_tolower(int c, rb_encoding *enc) | ||||
| { | ||||
|     return (ONIGENC_IS_ASCII_CODE(c)?ONIGENC_ASCII_CODE_TO_LOWER_CASE(c):(c)); | ||||
| } | ||||
|  | @ -1544,7 +1547,7 @@ VALUE | |||
| rb_locale_charmap(VALUE klass); | ||||
| 
 | ||||
| static void | ||||
| set_encoding_const(const char *name, const rb_encoding *enc) | ||||
| set_encoding_const(const char *name, rb_encoding *enc) | ||||
| { | ||||
|     VALUE encoding = rb_enc_from_encoding(enc); | ||||
|     char *s = (char *)name; | ||||
|  |  | |||
							
								
								
									
										2
									
								
								error.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								error.c
									
										
									
									
									
								
							|  | @ -1891,7 +1891,7 @@ Init_Exception(void) | |||
| } | ||||
| 
 | ||||
| void | ||||
| rb_enc_raise(const rb_encoding *enc, VALUE exc, const char *fmt, ...) | ||||
| rb_enc_raise(rb_encoding *enc, VALUE exc, const char *fmt, ...) | ||||
| { | ||||
|     va_list args; | ||||
|     VALUE mesg; | ||||
|  |  | |||
							
								
								
									
										18
									
								
								file.c
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								file.c
									
										
									
									
									
								
							|  | @ -2953,7 +2953,7 @@ skiproot(const char *path, const char *end, rb_encoding *enc) | |||
| 
 | ||||
| #define nextdirsep rb_enc_path_next | ||||
| char * | ||||
| rb_enc_path_next(const char *s, const char *e, const rb_encoding *enc) | ||||
| rb_enc_path_next(const char *s, const char *e, rb_encoding *enc) | ||||
| { | ||||
|     while (s < e && !isdirsep(*s)) { | ||||
| 	Inc(s, e, enc); | ||||
|  | @ -2967,7 +2967,7 @@ rb_enc_path_next(const char *s, const char *e, const rb_encoding *enc) | |||
| #define skipprefix(path, end, enc) (path) | ||||
| #endif | ||||
| char * | ||||
| rb_enc_path_skip_prefix(const char *path, const char *end, const rb_encoding *enc) | ||||
| rb_enc_path_skip_prefix(const char *path, const char *end, rb_encoding *enc) | ||||
| { | ||||
| #if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) | ||||
| #ifdef DOSISH_UNC | ||||
|  | @ -3001,7 +3001,7 @@ skipprefixroot(const char *path, const char *end, rb_encoding *enc) | |||
| 
 | ||||
| #define strrdirsep rb_enc_path_last_separator | ||||
| char * | ||||
| rb_enc_path_last_separator(const char *path, const char *end, const rb_encoding *enc) | ||||
| rb_enc_path_last_separator(const char *path, const char *end, rb_encoding *enc) | ||||
| { | ||||
|     char *last = NULL; | ||||
|     while (path < end) { | ||||
|  | @ -3019,7 +3019,7 @@ rb_enc_path_last_separator(const char *path, const char *end, const rb_encoding | |||
| } | ||||
| 
 | ||||
| static char * | ||||
| chompdirsep(const char *path, const char *end, const rb_encoding *enc) | ||||
| chompdirsep(const char *path, const char *end, rb_encoding *enc) | ||||
| { | ||||
|     while (path < end) { | ||||
| 	if (isdirsep(*path)) { | ||||
|  | @ -3035,7 +3035,7 @@ chompdirsep(const char *path, const char *end, const rb_encoding *enc) | |||
| } | ||||
| 
 | ||||
| char * | ||||
| rb_enc_path_end(const char *path, const char *end, const rb_encoding *enc) | ||||
| rb_enc_path_end(const char *path, const char *end, rb_encoding *enc) | ||||
| { | ||||
|     if (path < end && isdirsep(*path)) path++; | ||||
|     return chompdirsep(path, end, enc); | ||||
|  | @ -3043,7 +3043,7 @@ rb_enc_path_end(const char *path, const char *end, const rb_encoding *enc) | |||
| 
 | ||||
| #if USE_NTFS | ||||
| static char * | ||||
| ntfs_tail(const char *path, const char *end, const rb_encoding *enc) | ||||
| ntfs_tail(const char *path, const char *end, rb_encoding *enc) | ||||
| { | ||||
|     while (path < end && *path == '.') path++; | ||||
|     while (path < end && *path != ':') { | ||||
|  | @ -3833,7 +3833,7 @@ rb_file_s_realdirpath(int argc, VALUE *argv, VALUE klass) | |||
| } | ||||
| 
 | ||||
| static size_t | ||||
| rmext(const char *p, long l0, long l1, const char *e, long l2, const rb_encoding *enc) | ||||
| rmext(const char *p, long l0, long l1, const char *e, long l2, rb_encoding *enc) | ||||
| { | ||||
|     int len1, len2; | ||||
|     unsigned int c; | ||||
|  | @ -3869,7 +3869,7 @@ rmext(const char *p, long l0, long l1, const char *e, long l2, const rb_encoding | |||
| } | ||||
| 
 | ||||
| const char * | ||||
| ruby_enc_find_basename(const char *name, long *baselen, long *alllen, const rb_encoding *enc) | ||||
| ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encoding *enc) | ||||
| { | ||||
|     const char *p, *q, *e, *end; | ||||
| #if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC | ||||
|  | @ -4064,7 +4064,7 @@ rb_file_dirname(VALUE fname) | |||
|  * | ||||
|  */ | ||||
| const char * | ||||
| ruby_enc_find_extname(const char *name, long *len, const rb_encoding *enc) | ||||
| ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc) | ||||
| { | ||||
|     const char *p, *e, *end = name + (len ? *len : (long)strlen(name)); | ||||
| 
 | ||||
|  |  | |||
|  | @ -68,7 +68,7 @@ RUBY_SYMBOL_EXPORT_BEGIN | |||
|         ENC_CODERANGE_SET(rb_encoding_coderange_obj, (cr)); \ | ||||
|     } while (0) | ||||
| 
 | ||||
| typedef OnigEncodingType rb_encoding; | ||||
| typedef const OnigEncodingType rb_encoding; | ||||
| 
 | ||||
| int rb_char_to_option_kcode(int c, int *option, int *kcode); | ||||
| 
 | ||||
|  | @ -79,30 +79,30 @@ int rb_enc_get_index(VALUE obj); | |||
| void rb_enc_set_index(VALUE obj, int encindex); | ||||
| int rb_enc_find_index(const char *name); | ||||
| int rb_to_encoding_index(VALUE); | ||||
| rb_encoding* rb_to_encoding(VALUE); | ||||
| rb_encoding* rb_find_encoding(VALUE); | ||||
| rb_encoding* rb_enc_get(VALUE); | ||||
| rb_encoding* rb_enc_compatible(VALUE,VALUE); | ||||
| rb_encoding* rb_enc_check(VALUE,VALUE); | ||||
| rb_encoding *rb_to_encoding(VALUE); | ||||
| rb_encoding *rb_find_encoding(VALUE); | ||||
| rb_encoding *rb_enc_get(VALUE); | ||||
| rb_encoding *rb_enc_compatible(VALUE,VALUE); | ||||
| rb_encoding *rb_enc_check(VALUE,VALUE); | ||||
| VALUE rb_enc_associate_index(VALUE, int); | ||||
| VALUE rb_enc_associate(VALUE, const rb_encoding*); | ||||
| VALUE rb_enc_associate(VALUE, rb_encoding*); | ||||
| void rb_enc_copy(VALUE dst, VALUE src); | ||||
| 
 | ||||
| VALUE rb_enc_str_new(const char*, long, const rb_encoding*); | ||||
| VALUE rb_enc_str_new_cstr(const char*, const rb_encoding*); | ||||
| VALUE rb_enc_reg_new(const char*, long, const rb_encoding*, int); | ||||
| PRINTF_ARGS(VALUE rb_enc_sprintf(const rb_encoding *, const char*, ...), 2, 3); | ||||
| VALUE rb_enc_vsprintf(const rb_encoding *, const char*, va_list); | ||||
| long rb_enc_strlen(const char*, const char*, const rb_encoding*); | ||||
| char* rb_enc_nth(const char*, const char*, long, const rb_encoding*); | ||||
| VALUE rb_enc_str_new(const char*, long, rb_encoding*); | ||||
| VALUE rb_enc_str_new_cstr(const char*, rb_encoding*); | ||||
| VALUE rb_enc_reg_new(const char*, long, rb_encoding*, int); | ||||
| PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char*, ...), 2, 3); | ||||
| VALUE rb_enc_vsprintf(rb_encoding *, const char*, va_list); | ||||
| long rb_enc_strlen(const char*, const char*, rb_encoding*); | ||||
| char* rb_enc_nth(const char*, const char*, long, rb_encoding*); | ||||
| VALUE rb_obj_encoding(VALUE); | ||||
| VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, const rb_encoding *enc); | ||||
| VALUE rb_enc_uint_chr(unsigned int code, const rb_encoding *enc); | ||||
| VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc); | ||||
| VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc); | ||||
| 
 | ||||
| VALUE rb_external_str_new_with_enc(const char *ptr, long len, const rb_encoding *); | ||||
| VALUE rb_str_export_to_enc(VALUE, const rb_encoding *); | ||||
| VALUE rb_str_conv_enc(VALUE str, const rb_encoding *from, const rb_encoding *to); | ||||
| VALUE rb_str_conv_enc_opts(VALUE str, const rb_encoding *from, const rb_encoding *to, int ecflags, VALUE ecopts); | ||||
| VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *); | ||||
| VALUE rb_str_export_to_enc(VALUE, rb_encoding *); | ||||
| VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to); | ||||
| VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts); | ||||
| 
 | ||||
| #if defined(__GNUC__) && !defined(__PCC__) | ||||
| #define rb_enc_str_new_cstr(str, enc) __extension__ (	\ | ||||
|  | @ -113,13 +113,13 @@ VALUE rb_str_conv_enc_opts(VALUE str, const rb_encoding *from, const rb_encoding | |||
| }) | ||||
| #endif | ||||
| 
 | ||||
| PRINTF_ARGS(NORETURN(void rb_enc_raise(const rb_encoding *, VALUE, const char*, ...)), 3, 4); | ||||
| PRINTF_ARGS(NORETURN(void rb_enc_raise(rb_encoding *, VALUE, const char*, ...)), 3, 4); | ||||
| 
 | ||||
| /* index -> rb_encoding */ | ||||
| rb_encoding* rb_enc_from_index(int idx); | ||||
| rb_encoding *rb_enc_from_index(int idx); | ||||
| 
 | ||||
| /* name -> rb_encoding */ | ||||
| rb_encoding * rb_enc_find(const char *name); | ||||
| rb_encoding *rb_enc_find(const char *name); | ||||
| 
 | ||||
| /* rb_encoding * -> name */ | ||||
| #define rb_enc_name(enc) (enc)->name | ||||
|  | @ -129,13 +129,13 @@ rb_encoding * rb_enc_find(const char *name); | |||
| #define rb_enc_mbmaxlen(enc) (enc)->max_enc_len | ||||
| 
 | ||||
| /* -> mbclen (no error notification: 0 < ret <= e-p, no exception) */ | ||||
| int rb_enc_mbclen(const char *p, const char *e, const rb_encoding *enc); | ||||
| int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc); | ||||
| 
 | ||||
| /* -> mbclen (only for valid encoding) */ | ||||
| int rb_enc_fast_mbclen(const char *p, const char *e, const rb_encoding *enc); | ||||
| int rb_enc_fast_mbclen(const char *p, const char *e, rb_encoding *enc); | ||||
| 
 | ||||
| /* -> chlen, invalid or needmore */ | ||||
| int rb_enc_precise_mbclen(const char *p, const char *e, const rb_encoding *enc); | ||||
| int rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc); | ||||
| #define MBCLEN_CHARFOUND_P(ret)     ONIGENC_MBCLEN_CHARFOUND_P(ret) | ||||
| #define MBCLEN_CHARFOUND_LEN(ret)     ONIGENC_MBCLEN_CHARFOUND_LEN(ret) | ||||
| #define MBCLEN_INVALID_P(ret)       ONIGENC_MBCLEN_INVALID_P(ret) | ||||
|  | @ -143,22 +143,22 @@ int rb_enc_precise_mbclen(const char *p, const char *e, const rb_encoding *enc); | |||
| #define MBCLEN_NEEDMORE_LEN(ret)      ONIGENC_MBCLEN_NEEDMORE_LEN(ret) | ||||
| 
 | ||||
| /* -> 0x00..0x7f, -1 */ | ||||
| int rb_enc_ascget(const char *p, const char *e, int *len, const rb_encoding *enc); | ||||
| int rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc); | ||||
| 
 | ||||
| 
 | ||||
| /* -> code (and len) or raise exception */ | ||||
| unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, const rb_encoding *enc); | ||||
| unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, rb_encoding *enc); | ||||
| 
 | ||||
| /* prototype for obsolete function */ | ||||
| unsigned int rb_enc_codepoint(const char *p, const char *e, const rb_encoding *enc); | ||||
| unsigned int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc); | ||||
| /* overriding macro */ | ||||
| #define rb_enc_codepoint(p,e,enc) rb_enc_codepoint_len((p),(e),0,(enc)) | ||||
| #define rb_enc_mbc_to_codepoint(p, e, enc) ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e)) | ||||
| 
 | ||||
| /* -> codelen>0 or raise exception */ | ||||
| int rb_enc_codelen(int code, const rb_encoding *enc); | ||||
| int rb_enc_codelen(int code, rb_encoding *enc); | ||||
| /* -> 0 for invalid codepoint */ | ||||
| int rb_enc_code_to_mbclen(int code, const rb_encoding *enc); | ||||
| int rb_enc_code_to_mbclen(int code, rb_encoding *enc); | ||||
| #define rb_enc_code_to_mbclen(c, enc) ONIGENC_CODE_TO_MBCLEN((enc), (c)); | ||||
| 
 | ||||
| /* code,ptr,encoding -> write buf */ | ||||
|  | @ -187,19 +187,19 @@ int rb_enc_code_to_mbclen(int code, const rb_encoding *enc); | |||
| 
 | ||||
| #define rb_enc_asciicompat(enc) (rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc)) | ||||
| 
 | ||||
| int rb_enc_casefold(char *to, const char *p, const char *e, const rb_encoding *enc); | ||||
| int rb_enc_toupper(int c, const rb_encoding *enc); | ||||
| int rb_enc_tolower(int c, const rb_encoding *enc); | ||||
| ID rb_intern3(const char*, long, const rb_encoding*); | ||||
| ID rb_interned_id_p(const char *, long, const rb_encoding *); | ||||
| int rb_enc_symname_p(const char*, const rb_encoding*); | ||||
| int rb_enc_symname2_p(const char*, long, const rb_encoding*); | ||||
| int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc); | ||||
| int rb_enc_toupper(int c, rb_encoding *enc); | ||||
| int rb_enc_tolower(int c, rb_encoding *enc); | ||||
| ID rb_intern3(const char*, long, rb_encoding*); | ||||
| ID rb_interned_id_p(const char *, long, rb_encoding *); | ||||
| int rb_enc_symname_p(const char*, rb_encoding*); | ||||
| int rb_enc_symname2_p(const char*, long, rb_encoding*); | ||||
| int rb_enc_str_coderange(VALUE); | ||||
| long rb_str_coderange_scan_restartable(const char*, const char*, const rb_encoding*, int*); | ||||
| long rb_str_coderange_scan_restartable(const char*, const char*, rb_encoding*, int*); | ||||
| int rb_enc_str_asciionly_p(VALUE); | ||||
| #define rb_enc_str_asciicompat_p(str) rb_enc_asciicompat(rb_enc_get(str)) | ||||
| VALUE rb_enc_from_encoding(const rb_encoding *enc); | ||||
| int rb_enc_unicode_p(const rb_encoding *enc); | ||||
| VALUE rb_enc_from_encoding(rb_encoding *enc); | ||||
| int rb_enc_unicode_p(rb_encoding *enc); | ||||
| rb_encoding *rb_ascii8bit_encoding(void); | ||||
| rb_encoding *rb_utf8_encoding(void); | ||||
| rb_encoding *rb_usascii_encoding(void); | ||||
|  | @ -223,14 +223,14 @@ VALUE rb_enc_default_internal(void); | |||
| void rb_enc_set_default_external(VALUE encoding); | ||||
| void rb_enc_set_default_internal(VALUE encoding); | ||||
| VALUE rb_locale_charmap(VALUE klass); | ||||
| long rb_memsearch(const void*,long,const void*,long,const rb_encoding*); | ||||
| char *rb_enc_path_next(const char *,const char *,const rb_encoding*); | ||||
| char *rb_enc_path_skip_prefix(const char *,const char *,const rb_encoding*); | ||||
| char *rb_enc_path_last_separator(const char *,const char *,const rb_encoding*); | ||||
| char *rb_enc_path_end(const char *,const char *,const rb_encoding*); | ||||
| const char *ruby_enc_find_basename(const char *name, long *baselen, long *alllen, const rb_encoding *enc); | ||||
| const char *ruby_enc_find_extname(const char *name, long *len, const rb_encoding *enc); | ||||
| ID rb_check_id_cstr(const char *ptr, long len, const rb_encoding *enc); | ||||
| long rb_memsearch(const void*,long,const void*,long,rb_encoding*); | ||||
| char *rb_enc_path_next(const char *,const char *,rb_encoding*); | ||||
| char *rb_enc_path_skip_prefix(const char *,const char *,rb_encoding*); | ||||
| char *rb_enc_path_last_separator(const char *,const char *,rb_encoding*); | ||||
| char *rb_enc_path_end(const char *,const char *,rb_encoding*); | ||||
| const char *ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encoding *enc); | ||||
| const char *ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc); | ||||
| ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc); | ||||
| 
 | ||||
| RUBY_EXTERN VALUE rb_cEncoding; | ||||
| #define ENC_DUMMY_FLAG (1<<24) | ||||
|  | @ -242,7 +242,7 @@ RUBY_EXTERN VALUE rb_cEncoding; | |||
| #define ENC_SET_DUMMY(enc) ((enc)->ruby_encoding_index |= ENC_DUMMY_FLAG) | ||||
| 
 | ||||
| static inline int | ||||
| rb_enc_dummy_p(const rb_encoding *enc) | ||||
| rb_enc_dummy_p(rb_encoding *enc) | ||||
| { | ||||
|     return ENC_DUMMY_P(enc) != 0; | ||||
| } | ||||
|  |  | |||
|  | @ -769,7 +769,7 @@ VALUE rb_str_dynamic_intern(VALUE); | |||
| ID rb_check_id_without_pindown(VALUE *); | ||||
| ID rb_sym2id_without_pindown(VALUE); | ||||
| #ifdef RUBY_ENCODING_H | ||||
| ID rb_check_id_cstr_without_pindown(const char *, long, const rb_encoding *); | ||||
| ID rb_check_id_cstr_without_pindown(const char *, long, rb_encoding *); | ||||
| #endif | ||||
| ID rb_id_attrget(ID id); | ||||
| 
 | ||||
|  | @ -867,7 +867,7 @@ VALUE rb_id_quote_unprintable(ID); | |||
| void rb_str_fill_terminator(VALUE str, const int termlen); | ||||
| VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg); | ||||
| #ifdef RUBY_ENCODING_H | ||||
| VALUE rb_external_str_with_enc(VALUE str, const rb_encoding *eenc); | ||||
| VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc); | ||||
| #endif | ||||
| #define STR_NOEMBED      FL_USER1 | ||||
| #define STR_SHARED       FL_USER2 /* = ELTS_SHARED */ | ||||
|  |  | |||
|  | @ -2626,7 +2626,7 @@ rb_int_pred(VALUE num) | |||
| #define int_pred rb_int_pred | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_uint_chr(unsigned int code, const rb_encoding *enc) | ||||
| rb_enc_uint_chr(unsigned int code, rb_encoding *enc) | ||||
| { | ||||
|     int n; | ||||
|     VALUE str; | ||||
|  |  | |||
							
								
								
									
										20
									
								
								parse.y
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								parse.y
									
										
									
									
									
								
							|  | @ -304,7 +304,7 @@ struct parser_params { | |||
| #ifdef RIPPER | ||||
| #define intern_cstr_without_pindown(n,l,en) rb_intern3(n,l,en) | ||||
| #else | ||||
| static ID intern_cstr_without_pindown(const char *, long, const rb_encoding *); | ||||
| static ID intern_cstr_without_pindown(const char *, long, rb_encoding *); | ||||
| #endif | ||||
| 
 | ||||
| #define STR_NEW(p,n) rb_enc_str_new((p),(n),current_enc) | ||||
|  | @ -675,7 +675,7 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...); | |||
| #else | ||||
| # define rb_compile_error rb_compile_error_with_enc | ||||
| # define compile_error parser->nerr++,rb_compile_error_with_enc | ||||
| # define PARSER_ARG ruby_sourcefile, ruby_sourceline, current_enc, | ||||
| # define PARSER_ARG ruby_sourcefile, ruby_sourceline, (void *)current_enc, | ||||
| #endif | ||||
| 
 | ||||
| /* Older versions of Yacc set YYMAXDEPTH to a very low value by default (150, | ||||
|  | @ -10258,7 +10258,7 @@ id_type(ID id) | |||
| 
 | ||||
| #ifndef RIPPER | ||||
| static int | ||||
| is_special_global_name(const char *m, const char *e, const rb_encoding *enc) | ||||
| is_special_global_name(const char *m, const char *e, rb_encoding *enc) | ||||
| { | ||||
|     int mb = 0; | ||||
| 
 | ||||
|  | @ -10290,7 +10290,7 @@ rb_symname_p(const char *name) | |||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_symname_p(const char *name, const rb_encoding *enc) | ||||
| rb_enc_symname_p(const char *name, rb_encoding *enc) | ||||
| { | ||||
|     return rb_enc_symname2_p(name, strlen(name), enc); | ||||
| } | ||||
|  | @ -10299,7 +10299,7 @@ rb_enc_symname_p(const char *name, const rb_encoding *enc) | |||
| #define IDSET_ATTRSET_FOR_INTERN (~(~0U<<(1<<ID_SCOPE_SHIFT)) & ~(1U<<ID_ATTRSET)) | ||||
| 
 | ||||
| static int | ||||
| rb_enc_symname_type(const char *name, long len, const rb_encoding *enc, unsigned int allowed_attrset) | ||||
| rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset) | ||||
| { | ||||
|     const char *m = name; | ||||
|     const char *e = m + len; | ||||
|  | @ -10397,7 +10397,7 @@ rb_enc_symname_type(const char *name, long len, const rb_encoding *enc, unsigned | |||
| } | ||||
| 
 | ||||
| int | ||||
| rb_enc_symname2_p(const char *name, long len, const rb_encoding *enc) | ||||
| rb_enc_symname2_p(const char *name, long len, rb_encoding *enc) | ||||
| { | ||||
|     return rb_enc_symname_type(name, len, enc, IDSET_ATTRSET_FOR_SYNTAX) != -1; | ||||
| } | ||||
|  | @ -10507,7 +10507,7 @@ lookup_sym_id(st_data_t str, st_data_t *data) | |||
| } | ||||
| 
 | ||||
| static ID | ||||
| intern_cstr_without_pindown(const char *name, long len, const rb_encoding *enc) | ||||
| intern_cstr_without_pindown(const char *name, long len, rb_encoding *enc) | ||||
| { | ||||
|     st_data_t data; | ||||
|     struct RString fake_str; | ||||
|  | @ -10523,7 +10523,7 @@ intern_cstr_without_pindown(const char *name, long len, const rb_encoding *enc) | |||
| } | ||||
| 
 | ||||
| ID | ||||
| rb_intern3(const char *name, long len, const rb_encoding *enc) | ||||
| rb_intern3(const char *name, long len, rb_encoding *enc) | ||||
| { | ||||
|     ID id; | ||||
| 
 | ||||
|  | @ -11013,7 +11013,7 @@ rb_check_id(volatile VALUE *namep) | |||
| } | ||||
| 
 | ||||
| ID | ||||
| rb_check_id_cstr(const char *ptr, long len, const rb_encoding *enc) | ||||
| rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc) | ||||
| { | ||||
|     ID id; | ||||
| 
 | ||||
|  | @ -11080,7 +11080,7 @@ attrsetname_to_attr(VALUE name) | |||
| } | ||||
| 
 | ||||
| ID | ||||
| rb_check_id_cstr_without_pindown(const char *ptr, long len, const rb_encoding *enc) | ||||
| rb_check_id_cstr_without_pindown(const char *ptr, long len, rb_encoding *enc) | ||||
| { | ||||
|     st_data_t id; | ||||
|     struct RString fake_str; | ||||
|  |  | |||
							
								
								
									
										62
									
								
								re.c
									
										
									
									
									
								
							
							
						
						
									
										62
									
								
								re.c
									
										
									
									
									
								
							|  | @ -224,7 +224,7 @@ rb_memsearch_qs_utf8(const unsigned char *xs, long m, const unsigned char *ys, l | |||
| } | ||||
| 
 | ||||
| long | ||||
| rb_memsearch(const void *x0, long m, const void *y0, long n, const rb_encoding *enc) | ||||
| rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc) | ||||
| { | ||||
|     const unsigned char *x = x0, *y = y0; | ||||
| 
 | ||||
|  | @ -333,7 +333,7 @@ rb_reg_check(VALUE re) | |||
| 
 | ||||
| static void | ||||
| rb_reg_expr_str(VALUE str, const char *s, long len, | ||||
| 	const rb_encoding *enc, rb_encoding *resenc) | ||||
| 	rb_encoding *enc, rb_encoding *resenc) | ||||
| { | ||||
|     const char *p, *pend; | ||||
|     int cr = ENC_CODERANGE_UNKNOWN; | ||||
|  | @ -636,7 +636,7 @@ rb_reg_raise(const char *s, long len, const char *err, VALUE re) | |||
| } | ||||
| 
 | ||||
| static VALUE | ||||
| rb_enc_reg_error_desc(const char *s, long len, const rb_encoding *enc, int options, const char *err) | ||||
| rb_enc_reg_error_desc(const char *s, long len, rb_encoding *enc, int options, const char *err) | ||||
| { | ||||
|     char opts[6]; | ||||
|     VALUE desc = rb_str_buf_new2(err); | ||||
|  | @ -653,7 +653,7 @@ rb_enc_reg_error_desc(const char *s, long len, const rb_encoding *enc, int optio | |||
| } | ||||
| 
 | ||||
| static void | ||||
| rb_enc_reg_raise(const char *s, long len, const rb_encoding *enc, int options, const char *err) | ||||
| rb_enc_reg_raise(const char *s, long len, rb_encoding *enc, int options, const char *err) | ||||
| { | ||||
|     rb_exc_raise(rb_enc_reg_error_desc(s, len, enc, options, err)); | ||||
| } | ||||
|  | @ -826,7 +826,7 @@ onig_new_with_source(regex_t** reg, const UChar* pattern, const UChar* pattern_e | |||
| } | ||||
| 
 | ||||
| static Regexp* | ||||
| make_regexp(const char *s, long len, const rb_encoding *enc, int flags, onig_errmsg_buffer err, | ||||
| make_regexp(const char *s, long len, rb_encoding *enc, int flags, onig_errmsg_buffer err, | ||||
| 	const char *sourcefile, int sourceline) | ||||
| { | ||||
|     Regexp *rp; | ||||
|  | @ -1288,8 +1288,8 @@ rb_reg_fixed_encoding_p(VALUE re) | |||
| } | ||||
| 
 | ||||
| static VALUE | ||||
| rb_reg_preprocess(const char *p, const char *end, const rb_encoding *enc, | ||||
|         const rb_encoding **fixed_enc, onig_errmsg_buffer err); | ||||
| rb_reg_preprocess(const char *p, const char *end, rb_encoding *enc, | ||||
|         rb_encoding **fixed_enc, onig_errmsg_buffer err); | ||||
| 
 | ||||
| 
 | ||||
| static void | ||||
|  | @ -1301,10 +1301,10 @@ reg_enc_error(VALUE re, VALUE str) | |||
| 	     rb_enc_name(rb_enc_get(str))); | ||||
| } | ||||
| 
 | ||||
| static const rb_encoding* | ||||
| static rb_encoding* | ||||
| rb_reg_prepare_enc(VALUE re, VALUE str, int warn) | ||||
| { | ||||
|     const rb_encoding *enc = 0; | ||||
|     rb_encoding *enc = 0; | ||||
| 
 | ||||
|     if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) { | ||||
|         rb_raise(rb_eArgError, | ||||
|  | @ -1345,8 +1345,8 @@ rb_reg_prepare_re(VALUE re, VALUE str) | |||
|     OnigErrorInfo einfo; | ||||
|     const char *pattern; | ||||
|     VALUE unescaped; | ||||
|     const rb_encoding *fixed_enc = 0; | ||||
|     const rb_encoding *enc = rb_reg_prepare_enc(re, str, 1); | ||||
|     rb_encoding *fixed_enc = 0; | ||||
|     rb_encoding *enc = rb_reg_prepare_enc(re, str, 1); | ||||
| 
 | ||||
|     if (reg->enc == enc) return reg; | ||||
| 
 | ||||
|  | @ -1379,7 +1379,7 @@ long | |||
| rb_reg_adjust_startpos(VALUE re, VALUE str, long pos, int reverse) | ||||
| { | ||||
|     long range; | ||||
|     const rb_encoding *enc; | ||||
|     rb_encoding *enc; | ||||
|     UChar *p, *string; | ||||
| 
 | ||||
|     enc = rb_reg_prepare_enc(re, str, 0); | ||||
|  | @ -2087,8 +2087,8 @@ again: | |||
| } | ||||
| 
 | ||||
| static int | ||||
| unescape_escaped_nonascii(const char **pp, const char *end, const rb_encoding *enc, | ||||
|         VALUE buf, const rb_encoding **encp, onig_errmsg_buffer err) | ||||
| unescape_escaped_nonascii(const char **pp, const char *end, rb_encoding *enc, | ||||
|         VALUE buf, rb_encoding **encp, onig_errmsg_buffer err) | ||||
| { | ||||
|     const char *p = *pp; | ||||
|     int chmaxlen = rb_enc_mbmaxlen(enc); | ||||
|  | @ -2151,7 +2151,7 @@ check_unicode_range(unsigned long code, onig_errmsg_buffer err) | |||
| 
 | ||||
| static int | ||||
| append_utf8(unsigned long uv, | ||||
|         VALUE buf, const rb_encoding **encp, onig_errmsg_buffer err) | ||||
|         VALUE buf, rb_encoding **encp, onig_errmsg_buffer err) | ||||
| { | ||||
|     if (check_unicode_range(uv, err) != 0) | ||||
|         return -1; | ||||
|  | @ -2178,7 +2178,7 @@ append_utf8(unsigned long uv, | |||
| 
 | ||||
| static int | ||||
| unescape_unicode_list(const char **pp, const char *end, | ||||
|         VALUE buf, const rb_encoding **encp, onig_errmsg_buffer err) | ||||
|         VALUE buf, rb_encoding **encp, onig_errmsg_buffer err) | ||||
| { | ||||
|     const char *p = *pp; | ||||
|     int has_unicode = 0; | ||||
|  | @ -2215,7 +2215,7 @@ unescape_unicode_list(const char **pp, const char *end, | |||
| 
 | ||||
| static int | ||||
| unescape_unicode_bmp(const char **pp, const char *end, | ||||
|         VALUE buf, const rb_encoding **encp, onig_errmsg_buffer err) | ||||
|         VALUE buf, rb_encoding **encp, onig_errmsg_buffer err) | ||||
| { | ||||
|     const char *p = *pp; | ||||
|     size_t len; | ||||
|  | @ -2237,8 +2237,8 @@ unescape_unicode_bmp(const char **pp, const char *end, | |||
| } | ||||
| 
 | ||||
| static int | ||||
| unescape_nonascii(const char *p, const char *end, const rb_encoding *enc, | ||||
|         VALUE buf, const rb_encoding **encp, int *has_property, | ||||
| unescape_nonascii(const char *p, const char *end, rb_encoding *enc, | ||||
|         VALUE buf, rb_encoding **encp, int *has_property, | ||||
|         onig_errmsg_buffer err) | ||||
| { | ||||
|     char c; | ||||
|  | @ -2343,8 +2343,8 @@ escape_asis: | |||
| } | ||||
| 
 | ||||
| static VALUE | ||||
| rb_reg_preprocess(const char *p, const char *end, const rb_encoding *enc, | ||||
|         const rb_encoding **fixed_enc, onig_errmsg_buffer err) | ||||
| rb_reg_preprocess(const char *p, const char *end, rb_encoding *enc, | ||||
|         rb_encoding **fixed_enc, onig_errmsg_buffer err) | ||||
| { | ||||
|     VALUE buf; | ||||
|     int has_property = 0; | ||||
|  | @ -2375,11 +2375,11 @@ rb_reg_preprocess(const char *p, const char *end, const rb_encoding *enc, | |||
| VALUE | ||||
| rb_reg_check_preprocess(VALUE str) | ||||
| { | ||||
|     const rb_encoding *fixed_enc = 0; | ||||
|     rb_encoding *fixed_enc = 0; | ||||
|     onig_errmsg_buffer err = ""; | ||||
|     VALUE buf; | ||||
|     char *p, *end; | ||||
|     const rb_encoding *enc; | ||||
|     rb_encoding *enc; | ||||
| 
 | ||||
|     StringValue(str); | ||||
|     p = RSTRING_PTR(str); | ||||
|  | @ -2398,12 +2398,12 @@ rb_reg_check_preprocess(VALUE str) | |||
| static VALUE | ||||
| rb_reg_preprocess_dregexp(VALUE ary, int options) | ||||
| { | ||||
|     const rb_encoding *fixed_enc = 0; | ||||
|     const rb_encoding *regexp_enc = 0; | ||||
|     rb_encoding *fixed_enc = 0; | ||||
|     rb_encoding *regexp_enc = 0; | ||||
|     onig_errmsg_buffer err = ""; | ||||
|     int i; | ||||
|     VALUE result = 0; | ||||
|     const rb_encoding *ascii8bit = rb_ascii8bit_encoding(); | ||||
|     rb_encoding *ascii8bit = rb_ascii8bit_encoding(); | ||||
| 
 | ||||
|     if (RARRAY_LEN(ary) == 0) { | ||||
|         rb_raise(rb_eArgError, "no arguments given"); | ||||
|  | @ -2413,7 +2413,7 @@ rb_reg_preprocess_dregexp(VALUE ary, int options) | |||
|         VALUE str = RARRAY_AREF(ary, i); | ||||
|         VALUE buf; | ||||
|         char *p, *end; | ||||
|         const rb_encoding *src_enc; | ||||
|         rb_encoding *src_enc; | ||||
| 
 | ||||
| 	src_enc = rb_enc_get(str); | ||||
| 	if (options & ARG_ENCODING_NONE && | ||||
|  | @ -2454,14 +2454,14 @@ rb_reg_preprocess_dregexp(VALUE ary, int options) | |||
| } | ||||
| 
 | ||||
| static int | ||||
| rb_reg_initialize(VALUE obj, const char *s, long len, const rb_encoding *enc, | ||||
| rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc, | ||||
| 		  int options, onig_errmsg_buffer err, | ||||
| 		  const char *sourcefile, int sourceline) | ||||
| { | ||||
|     struct RRegexp *re = RREGEXP(obj); | ||||
|     VALUE unescaped; | ||||
|     const rb_encoding *fixed_enc = 0; | ||||
|     const rb_encoding *a_enc = rb_ascii8bit_encoding(); | ||||
|     rb_encoding *fixed_enc = 0; | ||||
|     rb_encoding *a_enc = rb_ascii8bit_encoding(); | ||||
| 
 | ||||
|     rb_check_frozen(obj); | ||||
|     if (FL_TEST(obj, REG_LITERAL)) | ||||
|  | @ -2577,7 +2577,7 @@ rb_reg_new_ary(VALUE ary, int opt) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_reg_new(const char *s, long len, const rb_encoding *enc, int options) | ||||
| rb_enc_reg_new(const char *s, long len, rb_encoding *enc, int options) | ||||
| { | ||||
|     VALUE re = rb_reg_alloc(); | ||||
|     onig_errmsg_buffer err = ""; | ||||
|  |  | |||
|  | @ -1192,7 +1192,7 @@ ruby__sfvextra(rb_printf_buffer *fp, size_t valsize, void *valp, long *sz, int s | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_vsprintf(const rb_encoding *enc, const char *fmt, va_list ap) | ||||
| rb_enc_vsprintf(rb_encoding *enc, const char *fmt, va_list ap) | ||||
| { | ||||
|     rb_printf_buffer_extra buffer; | ||||
| #define f buffer.base | ||||
|  | @ -1225,7 +1225,7 @@ rb_enc_vsprintf(const rb_encoding *enc, const char *fmt, va_list ap) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_sprintf(const rb_encoding *enc, const char *format, ...) | ||||
| rb_enc_sprintf(rb_encoding *enc, const char *format, ...) | ||||
| { | ||||
|     VALUE result; | ||||
|     va_list ap; | ||||
|  |  | |||
							
								
								
									
										26
									
								
								string.c
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								string.c
									
										
									
									
									
								
							|  | @ -333,7 +333,7 @@ coderange_scan(const char *p, long len, rb_encoding *enc) | |||
| } | ||||
| 
 | ||||
| long | ||||
| rb_str_coderange_scan_restartable(const char *s, const char *e, const rb_encoding *enc, int *cr) | ||||
| rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc, int *cr) | ||||
| { | ||||
|     const char *p = s; | ||||
| 
 | ||||
|  | @ -544,7 +544,7 @@ rb_usascii_str_new(const char *ptr, long len) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_str_new(const char *ptr, long len, const rb_encoding *enc) | ||||
| rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) | ||||
| { | ||||
|     VALUE str; | ||||
| 
 | ||||
|  | @ -571,7 +571,7 @@ rb_usascii_str_new_cstr(const char *ptr) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_str_new_cstr(const char *ptr, const rb_encoding *enc) | ||||
| rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc) | ||||
| { | ||||
|     must_not_null(ptr); | ||||
|     if (rb_enc_mbminlen(enc) != 1) { | ||||
|  | @ -599,7 +599,7 @@ rb_tainted_str_new_cstr(const char *ptr) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_str_conv_enc_opts(VALUE str, const rb_encoding *from, const rb_encoding *to, int ecflags, VALUE ecopts) | ||||
| rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts) | ||||
| { | ||||
|     extern VALUE rb_cEncodingConverter; | ||||
|     rb_econv_t *ec; | ||||
|  | @ -672,13 +672,13 @@ rb_str_conv_enc_opts(VALUE str, const rb_encoding *from, const rb_encoding *to, | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_str_conv_enc(VALUE str, const rb_encoding *from, const rb_encoding *to) | ||||
| rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to) | ||||
| { | ||||
|     return rb_str_conv_enc_opts(str, from, to, 0, Qnil); | ||||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_external_str_new_with_enc(const char *ptr, long len, const rb_encoding *eenc) | ||||
| rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *eenc) | ||||
| { | ||||
|     VALUE str; | ||||
| 
 | ||||
|  | @ -687,7 +687,7 @@ rb_external_str_new_with_enc(const char *ptr, long len, const rb_encoding *eenc) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_external_str_with_enc(VALUE str, const rb_encoding *eenc) | ||||
| rb_external_str_with_enc(VALUE str, rb_encoding *eenc) | ||||
| { | ||||
|     if (eenc == rb_usascii_encoding() && | ||||
| 	rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) { | ||||
|  | @ -747,7 +747,7 @@ rb_str_export_locale(VALUE str) | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_str_export_to_enc(VALUE str, const rb_encoding *enc) | ||||
| rb_str_export_to_enc(VALUE str, rb_encoding *enc) | ||||
| { | ||||
|     return rb_str_conv_enc(str, STR_ENC_GET(str), enc); | ||||
| } | ||||
|  | @ -1097,7 +1097,7 @@ count_utf8_lead_bytes_with_word(const uintptr_t *s) | |||
| #endif | ||||
| 
 | ||||
| static inline long | ||||
| enc_strlen(const char *p, const char *e, const rb_encoding *enc, int cr) | ||||
| enc_strlen(const char *p, const char *e, rb_encoding *enc, int cr) | ||||
| { | ||||
|     long c; | ||||
|     const char *q; | ||||
|  | @ -1168,7 +1168,7 @@ enc_strlen(const char *p, const char *e, const rb_encoding *enc, int cr) | |||
| } | ||||
| 
 | ||||
| long | ||||
| rb_enc_strlen(const char *p, const char *e, const rb_encoding *enc) | ||||
| rb_enc_strlen(const char *p, const char *e, rb_encoding *enc) | ||||
| { | ||||
|     return enc_strlen(p, e, enc, ENC_CODERANGE_UNKNOWN); | ||||
| } | ||||
|  | @ -1635,7 +1635,7 @@ rb_str_s_try_convert(VALUE dummy, VALUE str) | |||
| } | ||||
| 
 | ||||
| static char* | ||||
| str_nth_len(const char *p, const char *e, long *nthp, const rb_encoding *enc) | ||||
| str_nth_len(const char *p, const char *e, long *nthp, rb_encoding *enc) | ||||
| { | ||||
|     long nth = *nthp; | ||||
|     if (rb_enc_mbmaxlen(enc) == 1) { | ||||
|  | @ -1685,7 +1685,7 @@ str_nth_len(const char *p, const char *e, long *nthp, const rb_encoding *enc) | |||
| } | ||||
| 
 | ||||
| char* | ||||
| rb_enc_nth(const char *p, const char *e, long nth, const rb_encoding *enc) | ||||
| rb_enc_nth(const char *p, const char *e, long nth, rb_encoding *enc) | ||||
| { | ||||
|     return str_nth_len(p, e, &nth, enc); | ||||
| } | ||||
|  | @ -2152,7 +2152,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len, | |||
| } | ||||
| 
 | ||||
| VALUE | ||||
| rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, const rb_encoding *ptr_enc) | ||||
| rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *ptr_enc) | ||||
| { | ||||
|     return rb_enc_cr_str_buf_cat(str, ptr, len, | ||||
|         rb_enc_to_index(ptr_enc), ENC_CODERANGE_UNKNOWN, NULL); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 nobu
						nobu