summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Collapse)Author
2013-06-17* include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block):ktsj
new function to invoke a method with a block passed as an argument. * string.c (sym_call): use the above function to avoid a block sharing. [ruby-dev:47438] [Bug #8531] * vm_insnhelper.c (vm_yield_with_cfunc): don't set block in the frame. * test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc): run related tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07* internal.h (numberof): Gathered from various files.akr
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c, load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c, error.c, ruby.c: Remove the definitions of numberof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05* string.c (String#b): Allow code range scan to happen later soknu
ascii_only? on a result string returns the correct value. [ruby-core:55315] [Bug #8496] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-01string.c: remove old interfacesnobu
* string.c (rb_str_new[2-5], rb_{tainted,usascii}_str_new2), (rb_str_buf_new2): remove old interfaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24string.c: check argument typenobu
* string.c (rb_str_quote_unprintable): check if argument is a string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-20string.c: infectnobu
* string.c (rb_str_conv_enc_opts): should infect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19fix typos. Patch by k_takata.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18* string.c (str_scrub0): added for refactoring.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18* string.c (str_scrub_bang): add String#scrub!. [Feature #8414]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* string.c (rb_str_new_frozen): remove debug print.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko1
See this ticet about RGENGC. * gc.c: Add several flags: * RGENGC_DEBUG: if >0, then prints debug information. * RGENGC_CHECK_MODE: if >0, add assertions. * RGENGC_PROFILE: if >0, add profiling features. check GC.stat and GC::Profiler. * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0). * array.c: add write barriers for T_ARRAY and generate sunny objects. * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if you want to access raw pointers. If you modify the contents which pointer pointed, then you need to care write barrier. * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects. * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX and generate sunny objects. * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write barriers for T_RATIONAL and generate sunny objects. * internal.h: add write barriers for RBasic::klass. * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects. * object.c (rb_class_allocate_instance), range.c: generate sunny T_OBJECT objects. * string.c: add write barriers for T_STRING and generate sunny objects. * variable.c: add write barriers for ivars. * vm_insnhelper.c (vm_setivar): ditto. * include/ruby/ruby.h, debug.c: use two flags FL_WB_PROTECTED and FL_OLDGEN. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED): move flag bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-09* string.c: Add call-seq alias for String#=== [Bug #8381]zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24* string.c: Document String#setbyte return value by @gjmurakami-10genzzak
[Fixes GH-294] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-23* string.c (rb_str_inspect): refix r40413, on Ruby 1.9 usual characternaruse
escape uses hex/Unicode escapes, so fix to use Unicode escape on Unicode strings and hex on others. [ruby-core:54458] [Bug #8290] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-23string.c: fix for UTF-32nobu
* string.c (rb_str_scrub): fix for UTF-32. strlen() on strings contain NUL returns wrong result, use sizeof operator instead. [ruby-dev:45975] [Feature #6752] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-23string.c: suppress warningsnobu
* string.c (rb_str_scrub): suppress maybe-uninitialized and empty body in an else-statement. [ruby-dev:45975] [Feature #6752] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-23* string.c (rb_str_inspect): NUL should not be represented asknu
"\0" when octal digits may follow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19Add example for String#scrubnaruse
[Feature #6321] [Feature #6752] [Bug #7967] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19* string.c (str_scrub): add ruby method String#scrub which verify andnaruse
fix invalid byte sequence. * string.c (str_compat_and_valid): check given string is compatible and valid with given encoding. * transcode.c (str_transcode0): If invalid: :replace is specified for String#encode, replace invalid byte sequence even if the destination encoding equals to the source encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-14* string.c (String#gsub): fix typo in documentationeregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12* array.c: Document synonymous methods, by windwiny [GH-277]zzak
* bignum.c: ditto * complex.c: ditto * dir.c: ditto * encoding.c: ditto * enumerator.c: ditto * numeric.c: ditto * proc.c: ditto * re.c: ditto * string.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04reduce overhead of TYPEnobu
* array.c (ary_join_1): reduce overhead of TYPE(). * eval.c (rb_frozen_class_p, rb_mod_{append,prepend}_features): ditto. * string.c (rb_to_id): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-25string.c: performance improvementnobu
* string.c (rb_str_rpartition): get rid of conversion from byte offset to char offset and backward, for performance improvement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24* string.c (rb_str_rpartition): revert r39903, and convert byte offsetnaruse
to char offset; the return value of rb_reg_search is byte offset, but other than it of rb_str_rpartition expects char offset. [Bug #8138] [ruby-dev:47183] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24Fix String#rpartition(/re/) against a multibyte string.knu
* string.c (rb_str_rpartition): Fix String#rpartition(/re/) against a multibyte string. [Bug #8138] [ruby-dev:47183] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-21string.c: potential memory leaknobu
* string.c (rb_str_conv_enc_opts): allocate and hide wrapper before creating converter to be wrapped, to get rid of potential memory leak by failure on the allocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19convert with one converternobu
* string.c (rb_str_conv_enc_opts): convert with one converter, instead of re-creating converters for each buffer expansion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-25* string.c (str_byte_substr): don't set coderange if it's not known.naruse
[Bug #7954] [ruby-dev:47108] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-25string.c: STRING_ENUMERATORS_WANTARRAYnobu
* string.c (STRING_ENUMERATORS_WANTARRAY): name preprocessing codition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23* array.c: Document #<=> return values and formattingzzak
* bignum.c: ditto * file.c: ditto * object.c: ditto * numeric.c: ditto * rational.c: ditto * string.c: ditto * time.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-17compar.c: inversed comarison without infinite recursionnobu
* compar.c (rb_invcmp): compare by inversed comarison, with preventing from infinite recursion. [ruby-core:52305] [Bug #7870] * string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite recursion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-31* string.c (rb_str_aset_m): Documentation for String#[]= fixzzak
Raises an IndexError if Regexp match is out of range. Github fixes #243 Patch by Dmtiriy Budnik git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-05* string.c (rb_str_enumerate_lines): fix invalid byte sequence errorglass
when a separator is passed. The patch is from yoshidam (Yoshida Masato). [Bug #7646] [ruby-dev:46827] * test/ruby/test_string.rb: a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25string.c: empty string is not invalidnobu
* string.c (rb_enc_cr_str_copy_for_substr): empty string is always valid or 7bit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25string.c: reduce duplicated codenobu
* string.c (rb_str_enumerate_lines, rb_str_chop): reduce duplicated code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25string.c: GC guardnobu
* string.c (rb_str_enumerate_chars): prevent shared copy from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22internal.h: quote unprintablenobu
* internal.h (QUOTE, QUOTE_ID): quote unprintable chars in strings and IDs. [Bug #7574] [ruby-dev:46749] * string.c (rb_str_quote_unprintable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-08* eval.c (rb_mod_refine), vm_eval.c (rb_yield_refine_block):shugo
Module#refine activates all refinements defined in that module only in a given block. * string.c (sym_to_proc, sym_call): don't use refinements. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01adjust style.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30string.c: compare with to_strnobu
* string.c (rb_str_cmp_m): try to compare with to_str result if possible before calling <=> method. [ruby-core:49279] [Bug #7342] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30string.c: use rb_check_funcallnobu
* string.c (rb_str_cmp_m): use rb_check_funcall instead of respond_to and call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30string.c: always fixed valuenobu
* string.c (rb_str_cmp_m): return fixed value, one of -1,0,+1 always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27* string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)knu
(rb_str_enumerate_lines): Dummy initialization of ary has been replaced with UNINITIALIZED_VAR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27Suppress uninitialized variable warning with UNINITIALIZED_VAR()naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26string.c: suppress warningnobu
* string.c (rb_str_enumerate_bytes): suppress a uninitialized variable warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)kosaki
(rb_str_enumerate_lines): suppress "may be used uninitialized in this function" warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26string.c: suppress warningsnobu
* string.c (rb_str_enumerate_{lines,chars,codepoints}): suppress uninitialized variable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e