summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Collapse)Author
2013-11-01string.c: fix typonobu
* string.c (rb_str_scrub): fix typo, should yield invalid byte sequence to be scrubbed. reported by znz at IRC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-01string.c: export rb_str_scrubnobu
* string.c (rb_str_scrub): export with fixed length arguments, and allow nil as replacement string instead of omitting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-17* string.c (STR_HEAP_SIZE): includes TERM_LEN(str).ko1
* string.c (rb_str_memsize): use STR_HEAP_SIZE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-17* gc.c, internal.h: rename ruby_xsizefree/realloc toko1
rb_sized_free/realloc. * array.c: catch up these changes. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-17* array.c, string.c: use ruby_xsizedfree() and ruby_xsizedrealloc().ko1
* internal.h (SIZED_REALLOC_N): define a macro as REALLOC_N(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10string.c: use str_duplicatenobu
* string.c (rb_str_resurrect): use str_duplicate(), which does completely same. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09string.c: mark frozen stringnobu
* string.c (rb_fstring): because of lazy sweep, str may be unmaked already and swept at next time, so mark it for the time being. [ruby-core:57756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-25* include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().ko1
RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and usecase of this macro is not acquire raw pointer, but acquire read-only pointer. So we rename to better name. RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR() (I expect that nobody use it). * array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c, string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24string.c: fix for UTF-16/32nobu
* string.c (rb_str_inspect): get rid of out-of-bound access. * string.c (rb_str_inspect): when a UTF-16/32 string doesn't have a BOM, inspect as a dummy encoding string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-20string.c: scan coderangenobu
* string.c (rb_str_conv_enc_opts): make sure to scan coderange to get rid of unnecessary conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-18* string.c (rb_str_enumerate_lines): make String#each_line andglass
#lines not raise invalid byte sequence error when it is called with an argument. The patch also causes performance improvement. [ruby-dev:47549] [Bug #8698] * test/ruby/test_m17n_comb.rb (test_str_each_line): remove assertions which check that String#each_line and #lines will raise an error if the receiver includes invalid byte sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-05* string.c (fstring_cmp): take string encoding into account whencharliesome
comparing fstrings [ruby-core:57037] [Bug #8866] * test/ruby/test_string.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-05string.c: reduce objects in rb_fstringnobu
* string.c (rb_fstring, rb_str_free): use st_data_t instead of VALUE. * string.c (rb_fstring): get rid of duplicating already frozen object. * parse.y (str_suffix_gen): freeze in advance to reduce objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-05* include/ruby/ruby.h: add RSTRING_FSTR flagcharliesome
* internal.h: add rb_fstring() prototype * parse.y (str_suffix_gen): deduplicate frozen string literals * string.c (rb_fstring): deduplicate frozen string literals * string.c (rb_str_free): delete fstrings from frozen_strings table when they are GC'd * string.c (Init_String): initialize frozen_strings table * test/ruby/test_string.rb: test frozen strings are deduplicated git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04string.c: fix for \Knobu
* string.c (str_gsub): use BEG(0) for whole matched position not return value from rb_reg_search(), for \K matching. [ruby-dev:47694] [Bug #8856] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03string.c: rb_enc_str_new_cstrnobu
* string.c (rb_enc_str_new_cstr): new function to create a string from the C-string pointer with the specified encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-31dir.c: reduce string objectnobu
* dir.c (dir_each): get rid of allocate new string from UTF-8 string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08* string.c (rb_str_format_m): use RARRAY_RAWPTR() instead ofko1
RARRAY_PTR() because there is no new reference. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-07* string.c: [DOC] Description of rb_str_equal [Fixes GH-375]zzak
Based on a patch by @markijbema https://github.com/ruby/ruby/pull/375 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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