summaryrefslogtreecommitdiff
path: root/encoding.c
AgeCommit message (Collapse)Author
2016-04-25* encoding.c: Fix return value of `Encoding::ISO8859_1.name`hsbt
[Bug #12313][ruby-core:75147][ci skip] * ext/bigdecimal/bigdecimal.c: Fix code sample of `BigDecimal.new` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-29* include/ruby/ruby.h (rb_isupper, rb_islower, rb_isalpha, rb_isdigit,naruse
rb_isalnum, rb_isxdigit, rb_isblank, rb_isspace, rb_isblank, rb_iscntrl, rb_isprint, rb_ispunct, rb_isgraph, rb_tolower, rb_toupper): use inline function to avoid function call. * include/ruby/ruby.h (rb_isascii): use inline function to clarify the logic. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-22RUBY_ASSERTnobu
* error.c (rb_assert_failure): assertion with stack dump. * ruby_assert.h (RUBY_ASSERT): new header for the assertion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08* introduce new ISeq binary format serializer/de-serializerko1
and a pre-compilation/runtime loader sample. [Feature #11788] * iseq.c: add new methods: * RubyVM::InstructionSequence#to_binary_format(extra_data = nil) * RubyVM::InstructionSequence.from_binary_format(binary) * RubyVM::InstructionSequence.from_binary_format_extra_data(binary) * compile.c: implement body of this new feature. * load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq): call RubyVM::InstructionSequence.load_iseq(fname) with loading script name if this method is defined. We can return any ISeq object as a result value. Otherwise loading will be continue as usual. This interface is not matured and is not extensible. So that we don't guarantee the future compatibility of this method. Basically, you should'nt use this method. * iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions) from iseq.c. * encoding.c (rb_data_is_encoding), internal.h: added. * vm_core.h: add several supports for lazy load. * add USE_LAZY_LOAD macro to specify enable or disable of this feature. * add several fields to rb_iseq_t. * introduce new macro rb_iseq_check(). * insns.def: some check for lazy loading feature. * vm_insnhelper.c: ditto. * proc.c: ditto. * vm.c: ditto. * test/lib/iseq_loader_checker.rb: enabled iff suitable environment variables are provided. * test/runner.rb: enable lib/iseq_loader_checker.rb. * sample/iseq_loader.rb: add sample compiler and loader. $ ruby sample/iseq_loader.rb [dir] will compile all ruby scripts in [dir]. With default setting, this compile creates *.rb.yarb files in same directory of target .rb scripts. $ ruby -r sample/iseq_loader.rb [app] will run with enable to load compiled binary data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02encoding.c: make fstringnobu
* encoding.c (enc_name, rb_enc_name_list_i, rb_enc_aliases_enc_i): make fstring instead of making each copies. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02encoding.c: defer finding encodingnobu
* encoding.c (enc_m_loader): defer finding encoding object not to be infected by marshal source. [ruby-core:71793] [Bug #11760] * marshal.c (r_object0): enable compatible loader on USERDEF class. the loader function is called with the class itself, instead of an allocated object, and the loaded data. * marshal.c (compat_allocator_table): intialize compat_allocator_tbl on demand. * object.c (rb_undefined_alloc): extract from rb_obj_alloc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02encoding.c: use rb_check_aritynobu
* encoding.c (enc_dump): use rb_check_arity to just check number of arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29ENC_ASSERTnobu
* encoding.c (ENC_ASSERT): make an expression, and prevent the argument from further expansions. * encoding.c (rb_enc_check_str): assert before using. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29indentnobu
* encoding.c (enc_compatible_latter): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* encoding.c (rb_enc_check_str): add for performance.ko1
This function only accept T_STRING (and T_REGEXP). This patch improves performance of a tiny_segmenter benchmark (num=2) 2.54sec -> 2.42sec on my machine. https://github.com/chezou/TinySegmenter.jl/blob/master/benchmark/benchmark.rb * encoding.c: add ENC_DEBUG and ENC_ASSERT() macros. * internal.h: add a decl. of rb_enc_check_str(). * string.c (rb_str_plus): use rb_enc_check_str(). * string.c (rb_str_subpat_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29revert r52336 (commit miss)ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* gc.c (gc_mark_ptr): remove debug code for #11244.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15encindex.h: ENCINDEXnobu
* encindex.h: separate encoding index constants from internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-07localeinit.c: locale_charmap rdoc [ci skip]nobu
* localeinit.c (rb_locale_charmap): [RDOC] move Encoding.locale_charmap rdoc from encoding.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-30encoding.c: fix document [ci skip]nobu
* encoding.c (rb_enc_unicode_p): fix document. predicate functions may return non-zero values other than 1 as true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-24encoding.c: find encoding indexnobu
* encoding.c (rb_locale_encindex): find encoding index without making a string object every time. [ruby-core:58160] [Bug #9080] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-15encoding.c: drop dummy encoding flagnobu
* encoding.c (enc_autoload): drop dummy encoding flag from the loaded encoding index. this flag is used only in this source. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16use rb_funcallvnobu
* use rb_funcallv() for no arguments call instead of variadic rb_funcall(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03encoding.c: load by rb_require_internalnobu
* encoding.c (load_encoding): use rb_require_internal instead of calling rb_require_safe with protection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01use 0 for reservednobu
use 0 for rb_data_type_t::reserved instead of NULL, since its type may be changed in the future and possibly not a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-28* encoding.c: remove unnecessary declaration of rb_locale_charmap(). it'susa
already declared in include/ruby/encoding.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18* internal.h: Gather declarations in non-header files.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03encoding.c (enc_memsize): remove unnecessary functionnormal
Trims our binary size slightly (numbers from x86-64): text data bss dec hex filename 2795184 22766 72024 2889974 2c18f6 ruby.before 2795112 22766 72024 2889902 2c18ae ruby.after [ruby-core:65304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28symbols instead of IDsnobu
* encoding.c (rb_enc_get_index): deal with symbols instead of IDs to get rid of inadvertent pin-downs. * enum.c (chunk_ii): ditto. * enumerator.c (append_method): ditto. * iseq.c (iseq_load): ditto. * marshal.c (w_symbol, r_symlink, r_symreal, r_symbol): ditto. * signal.c (trap_handler): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-20encoding.c: fix rdoc [ci skip]nobu
* encoding.c (enc_find): [DOC] never accepted a symbol. [ruby-dev:48308] [Bug #9966] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02encoding.c: move ruby_encoding_index stuffnobu
* encoding.c: move `ruby_encoding_index` stuff from include/ruby/encoding.h to hide the extra field. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02encoding.h: constify rb_encodingnobu
* 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
2014-06-01constify rb_encoding and OnigEncodingnobu
* include/ruby/encoding.h: constify `rb_encoding` arguments. * include/ruby/oniguruma.h: constify `OnigEncoding` arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-09encoding.c: fix rdoc of `__FILE__`nobu
* encoding.c (rb_enc_default_internal): fix rdoc. `__FILE__` is in filesystem encoding but not `default_internal`. [ruby-core:61894] [Bug #9713] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26parse.y: set encodingnobu
* parse.y (rb_str_dynamic_intern): associate proper encoding with the result symbol. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26encoding.c: fix encoding of dynsymnobu
* encoding.c (rb_enc_get_index): the encoding of dynamic symbol comes from fstr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26encoding.c: enc_capable symbolnobu
* encoding.c (enc_capable): Symbol is now encoding capable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-15string.c: use actual encodingsnobu
* string.c (get_actual_encoding): get actual encoding according to the BOM if exists. * string.c (rb_str_inspect): use according encoding, instead of pseudo encodings, UTF-{16,32}. [ruby-core:59757] [Bug #8940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-30encoding.c: mask dummy flagsnobu
* encoding.c (must_encindex, rb_enc_from_index, rb_obj_encoding): mask encoding index and ignore dummy flags. [ruby-core:59354] [Bug #9314] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10* doc/contributing.rdoc: [DOC] curses is no more in the stdliba_matsuda
* doc/contributors.rdoc: Ditto. * doc/maintainers.rdoc: Ditto. * doc/contributors.rdoc: Ditto. * doc/standard_library.rdoc: Ditto. * doc/syntax/modules_and_classes.rdoc: Ditto. * encoding.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko1
safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-21encoding.c: preserve outer errinfonobu
* encoding.c (load_encoding): should preserve outer errinfo, so that expected exception may not be lost. [ruby-core:57949] [Bug #9038] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19encoding.c: defer code page tablenobu
* encoding.c (rb_locale_encindex): defer initialization of win32 code page table until encoding db loaded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07win32/file.c: make mapping at initializationnobu
* win32/file.c (code_page_i, rb_w32_init_file): make encoding to code page mapping at initialization directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24encdb.c, encoding.c: make BOM-encodings dummynobu
* enc/encdb.c (ENC_DUMMY_UNICODE): make BOM-encodings dummy. * encoding.c (enc_autoload): keep dummy encodings dummy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25encoding.c: is_obj_encodingnobu
* encoding.c (is_obj_encoding): new macro to check if obj is an Encoding. obj can be any type while is_data_encoding expects T_DATA only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25* encoding.c (check_encoding): Check T_DATA or not.ko1
is_data_encoding(obj) assumes that `obj' is T_DATA. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-20encoding.c: add rb_enc_code_to_mbclennobu
* encoding.c (rb_enc_code_to_mbclen): add new function which returns mbclen from codepoint like as rb_enc_codelen() but 0 for invalid char. * include/ruby/encoding.h (rb_enc_code_to_mbclen): declaration and shortcut macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16encoding.c: revert r41964nobu
* encoding.c (enc_set_index): since r41967, old terminator is dealt with in str_fill_term(). should not consider it here because this function is called before any encoding is set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14localeinit.c: splitnobu
* localeinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding): move from encoding.c. * miniinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding): define miniruby specific functions only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14encoding.c: NO_PRESERVED_ENCODINGnobu
* encoding.c (rb_enc_init): no longer needs NO_PRESERVED_ENCODING. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14encoding.c: defer autoloadnobu
* encoding.c (enc_inspect): defer loading autoloaded encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14encoding.c: encoding checknobu
* encoding.c (enc_check_encoding): use is_data_encoding() to check type consistently. * encoding.c (must_encoding): return rb_encoding* instead of encoding index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14encoding.c: encoding at inspectnobu
* encoding.c (enc_inspect): use PRIsVALUE to preserve the result encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e