summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Collapse)Author
2013-08-06string.c: fix typonobu
* string.c (rb_str_ellipsize): [DOC] fix typo, "encoding" instead of "encoded" which is probably a slip of the auto-completion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* string.c (str_rindex): remove comment.glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* string.c (rb_str_rindex): fix bug introduced in r42269.glass
"".rindex("") should return 0. (str_rindex): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* string.c (rb_str_rindex): performance improvement by usingglass
memrchr(3). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* string.c (rb_str_rindex): refactoring and avoid to call str_nth() ifglass
pos == 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-28* string.c: add internal API rb_str_locktmp_ensure().glass
* io.c (io_fread): use rb_str_locktmp_ensure(). [ruby-core:56121] [Bug #8669] * test/ruby/test_io.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22* string.c (rb_str_enumerate_chars): specify array capaglass
with str_strlen(). * string.c (rb_str_enumerate_codepoints): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22* string.c (rb_str_enumerate_chars): specify array capa.glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22* string.c (rb_str_each_char_size): performance implement byglass
using rb_str_length(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-20* string.c (rb_str_succ): add missing case NEIGHBOR_WRAPPED.naruse
r42078 caused buggy behavior like "\xFF".b -> "\x01\xFF".b git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-20string.c: wchar succnobu
* string.c (enc_succ_char, enc_pred_char): consider wchar case. [ruby-core:56071] [Bug #8653] * string.c (rb_str_succ): do not replace with invalid char. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18* string.c (str_alloc): no need to clear RString (already cleared).ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14string.c: char lengthnobu
* string.c (str_null_char): calculate char length. fix commit miss at r41967. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14string.c: consider old terminatornobu
* string.c (str_fill_term): consider old terminator length, and should not use rb_enc_ascget since it depends on the current encoding which may not be compatible with the new terminator. [Bug #8634] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-12encoding.c: refill terminator at associating encodingnobu
* encoding.c (rb_enc_associate_index): refill the terminator if it becomes longer than before. [ruby-dev:47500] [Bug #8624] * string.c (str_null_char, str_fill_term): get rid of out of bound access. * string.c (rb_str_fill_terminator): add a parameter for the length of new terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11transcode.c: fill terminatornobu
* transcode.c (str_encode_associate): fill terminator after conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11string.c: multi-byte terminatornobu
* string.c (rb_enc_str_new, rb_str_set_len, rb_str_resize): fill minimum length of the encoding as the terminator. * string.c (str_buf_cat, rb_str_buf_append, rb_str_splice_0): ditto. * string.c (str_make_independent_expand, rb_str_modify_expand): make the capacity enough for multi-byte terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11string.c: multi-byte terminatornobu
* string.c (rb_string_value_cstr): fill minimum length of the encoding as the terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11string.c: check null charnobu
* string.c (rb_string_value_cstr): check null char in char, not in byte. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-10string.c: rb_str_subposnobu
* string.c (rb_str_subpos): make public function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-10* string.c (rb_str_index): cache single byte flag and someglass
cosmetic changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09Add a missing line for rb_str_equal of string.c by @JuanitoFatas [fixes GH-353]hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-04* string.c (rb_str_succ): use ONIGENC_MBCLEN_CHARFOUND_P correctly.naruse
* string.c (rb_str_dump): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02string.c: use built-in encoding indexesnobu
* internal.h: add UTF-{16,32} dummy encodings. * string.c (rb_str_inspect, str_scrub0): use built-in encoding indexes in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01Revert r41728naruse
* string.c (rb_str_inspect): use encoding index macros in encdb.h. It breaks build because encdb.h requires miniruby and modified miniruby requires encdb.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01* string.c (rb_str_inspect): use encoding index macros in encdb.h.naruse
* string.c (str_scrub0): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01string.c: coderange appending to empty stringnobu
* string.c (rb_enc_cr_str_buf_cat, rb_str_append): consider an empty string 7bit-clean and should not discard cached coderange of string to be appended. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26intern.h: define rb_enumerator_size_funcnobu
* include/ruby/intern.h (rb_enumerator_size_func): define strict function declaration for rb_enumeratorize_with_size(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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