Граф коммитов

225 Коммитов

Автор SHA1 Сообщение Дата
matz 5e2c8a40c3 * string.c (str_gsub): internal buffer should not be listed by
ObjectSpace.each_object().  [ruby-dev:24919]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-18 16:02:08 +00:00
matz 288ceaeec2 * re.c (rb_reg_initialize_m): should raise exception instead of
compile error.  [ruby-core:03755]

* string.c (rb_str_splice): move rb_str_modify() after
  StringValue(), which may alter the receiver.  [ruby-dev:24878]

* error.c (rb_error_frozen): now raise RuntimeError instead of
  TypeError.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-17 02:27:38 +00:00
matz b93479b8d9 * string.c (str_mod_check): frozen check should be separated.
[ruby-core:3742]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-16 04:55:14 +00:00
matz 67d54f209d * array.c (rb_ary_update): pedantic check to detect
rb_ary_to_ary() to modify the receiver.  [ruby-dev:24861]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-15 16:45:03 +00:00
matz 0f36ecebe0 * string.c (rb_str_clear): avoid revealing NULL pointer.
[ruby-dev:24766]

* string.c (str_gsub): add paranoid check. [ruby-dev:24827]

* string.c (str_mod_check): check frozen status as well.
  [ruby-dev:24801]

* lib/mathn.rb (Integer::gcd2): faster implementation by
  <erlercw@siu.edu>. [ruby-talk:120232]

* ext/gdbm/gdbm.c (fgdbm_store): StringValue() may alter string
  pointer.  [ruby-dev:24783]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-14 15:41:40 +00:00
matz 683400f427 * dir.c (rb_glob2): do not allocate buffer from heap to avoid
memory leaks.  use string object for buffering instead.
  [ruby-dev:24738]

* dir.c (join_path): ditto.

* io.c (io_read): external input buffer may be modified even after
  rb_str_locktmp().  [ruby-dev:24735]

* dir.c (fnmatch): p or s may be NULL.  [ruby-dev:24749]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-10 07:17:53 +00:00
matz 28d67a0bfe * string.c (str_gsub): should have removed rb_str_unlocktmp(str).
[ruby-dev:24708]

* ext/socket/socket.c (s_recvfrom): buffer modification check.
  [ruby-dev:24708]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-04 23:43:40 +00:00
matz 67ae0fb9ac * string.c (str_gsub): string modify check no longer based on
tmplock.  [ruby-dev:24706]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-04 12:27:57 +00:00
matz 27715649f4 * gc.c (gc_mark): enable GC stack checking.
* string.c (str_gsub): lock strings temporarily.  [ruby-dev:24687]

* ext/socket/socket.c (s_recvfrom): tmplock input buffer.
  [ruby-dev:24705]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-04 00:53:21 +00:00
matz 3be03e9294 * array.c (rb_ary_uniq_bang): do not push frozen string from hash
table.  [ruby-dev:24695]

* array.c (rb_ary_and): ditto.

* array.c (rb_ary_or): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-03 11:34:57 +00:00
matz 8db864c999 * io.c (rb_f_open): create copy of popen specifier. [ruby-dev:24656]
* string.c (rb_str_locktmp): lock string temporarily.

* string.c (str_independent): add tmplock check.

* io.c (io_write): lock output string temporarily.
  [ruby-dev:24649]

* io.c (io_write): use rb_str_locktmp().

* io.c (read_all): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-31 17:37:52 +00:00
nobu 4fabf11840 * string.c (str_gsub): use STR_NOCAPA.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-27 15:23:16 +00:00
matz 018837b84f * node.h (NODE_TYPESHIFT): allow 4 more bits for line numbers.
[ruby-talk:117841]

* ruby.h (FL_ABLE): nodes are not subject for flag operations.

* io.c (ARGF_FORWARD): should have specified argv explicitly,
  since we no longer have frame->argv saved.  [ruby-dev:24602]

* string.c (RESIZE_CAPA): check string attribute before modifying
  capacity member of string structure.  [ruby-dev:24594]

* ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain
  performance.  [ruby-talk:117701]

* sprintf.c (rb_f_sprintf): raise ArgumentError for extra
  arguments, unless (digit)$ style used.

* io.c (rb_io_fptr_finalize): leave stdin/stdout/stderr open in
  interpreter termination.  [ruby-dev:24579]

* eval.c (frame_free): Guy Decoux solved the leak problem.
  Thanks.  [ruby-core:03549]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-27 09:29:26 +00:00
nobu ee51d0f9fd * string.c (str_gsub): use a string object for exception safeness.
[ruby-dev:24601]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-27 00:18:08 +00:00
nobu 0f3decb071 * string.c (rb_str_include): should not treat char as negative value.
[ruby-dev:24558]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-21 15:21:08 +00:00
matz 7d7d82463d * parse.y (lex_getline): should not touch ruby_debug_lines if
RIPPER is defined.  [ruby-dev:24547]

* string.c (str_gsub): 	reentrant check.  [ruby-dev:24432]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-20 15:44:06 +00:00
matz 1057902ac7 * io.c (read_all): block string buffer modification during
rb_io_fread() by freezing it temporarily. [ruby-dev:24479]

* dir.c (rb_push_glob): block call at once the end of method.
  [ruby-dev:24487]

* ext/enumerator/enumerator.c (enum_each_slice): remove
  rb_gc_force_recycle() to prevent potential SEGV.
  [ruby-dev:24499]

* ext/zlib/zlib.c (zstream_expand_buffer): hide internal string
  buffer by clearing klass.  [ruby-dev:24510]

* ext/socket/socket.c (sock_s_getservbyaname): protocol string
  might be altered.  [ruby-dev:24503]

* string.c (rb_str_upto): check if return value from succ is a
  string.  [ruby-dev:24504]

* io.c (rb_io_popen): get mode string via rb_io_flags_mode() to
  avoid mode string modification.  [ruby-dev:24454]

* io.c (rb_io_getline_fast): should take delim as unsigned char to
  distinguish EOF and '\377'.  [ruby-dev:24460]

* io.c (rb_io_getline): add check for RS modification.
  [ruby-dev:24461]

* enum.c (enum_sort_by): use qsort() directly instead using
  rb_iterate().  [ruby-dev:24462]

* enum.c (enum_each_with_index): remove rb_gc_force_recycle() to
  prevent access to recycled object (via continuation for
  example).  [ruby-dev:24463]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-19 10:25:23 +00:00
nobu 9bd744a092 * indent and tabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-19 00:03:01 +00:00
nobu 39324f819f * string.c (rb_str_upto): method result must be checked. [ruby-dev:24504]
* eval.c (error_print): ditto.  [ruby-dev:24519]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-18 23:47:32 +00:00
matz fbb88b011a * io.c (rb_io_mode_flags): preserve append mode flag.
[ruby-dev:24436]

* io.c (rb_io_modenum_mode): do not use external output buffer.

* string.c (rb_str_justify): differ pointer retrieval to prevent
  padding string modification.  [ruby-dev:24434]

* range.c (range_each_func): allow func to terminate loop by
  returning RANGE_EACH_BREAK.

* range.c (member_i): use RANGE_EACH_BREAK. [ruby-talk:114959]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-06 07:40:06 +00:00
matz 77636d0364 * string.c (rb_str_sum): should use bignums when bits is greater
than or equals to sizeof(long)*CHAR_BITS. [ruby-dev:24395]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-02 11:30:40 +00:00
matz 779f3d6d11 * string.c (rb_str_sum): wrong cast caused wrong result.
[ruby-dev:24385]

* enum.c (enum_sort_by): hide temporary array from
  ObjectSpace.each_object.  [ruby-dev:24386]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-02 07:57:32 +00:00
matz 9d923be604 * string.c (rb_str_sum): check was done with false pointer.
[ruby-dev:24383]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-02 03:49:15 +00:00
matz 1b4d97ddba * string.c (rb_str_sum): string may be altered. [ruby-dev:24381]
* eval.c (rb_f_eval): defer pointer retrieval to prevent unsafe
  sourcefile string modification.  [ruby-dev:24373]

* io.c (io_read): block string buffer modification during
  rb_io_fread() by freezing it temporarily. [ruby-dev:24366]

* io.c (rb_io_s_popen): mode argument may be altered.
  [ruby-dev:24375]

* file.c (rb_file_s_basename): ext argument may be altered.
  [ruby-dev:24377]

* enum.c (enum_sort_by): use NODE instead of 2 element arrays.
  [ruby-dev:24378]

* string.c (rb_str_chomp_bang): StringValue() may change the
  receiver.  [ruby-dev:24371]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-01 15:56:05 +00:00
matz c0a998d027 * parse.y (rb_parser_append_print): should handle prelude.
[llama@u01.gate0]

* parse.y (rb_parser_while_loop): ditto.

* array.c (rb_ary_subseq): original object might be modified after
  sharing data creation.  [ruby-dev:24327]

* array.c (rb_ary_replace): ditto.

* array.c (ary_make_shared): freeze shared array. [ruby-dev:24325]

* struct.c (struct_members): always check struct size and size of
  members list in the class.  [ruby-dev:24320]

* string.c (rb_str_sub_bang): check if string is not modified
  during iteration.  [ruby-dev:24315]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-24 05:53:43 +00:00
matz e77ddaf0d1 * array.c (rb_ary_delete): element comparison might change array
size. [ruby-dev:24273]

* parse.y: make ruby parser reentrant. merge ripper parser to the
  real one.  this change makes ruby require bison.

* file.c (rb_file_truncate): clear stdio buffer before truncating
  the file.  [ruby-dev:24191]

* ext/digest/digest.c: use rb_obj_class() instead of CLASS_OF
  which might return singleton class.  [ruby-dev:24202]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-17 09:24:13 +00:00
matz d73fa69935 * dir.c (free_dir): fix memory leak. reported by yamamoto
madoka.

* eval.c (bind_eval): new method. [RCR 251]

* string.c (rb_str_clear): new method. [ruby-dev:24104]

* io.c (rb_io_reopen): should clear allocated OpenFile.  pointed
  out by Guy Decoux. [ruby-core:03288]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-19 07:33:15 +00:00
matz 67232b2151 * io.c (rb_io_reopen): should clear allocated OpenFile. pointed
out by Guy Decoux. [ruby-core:03288]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-17 09:02:40 +00:00
matz 280d014d6d * range.c (rb_range_beg_len): returns Qnil only when "beg" points
outside of a range.  No boundary check for "end".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-24 09:48:21 +00:00
matz 83fa0928d7 * string.c (rb_str_match_m): String#match should also take
optional argument.  [ruby-core:03205]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-17 08:02:20 +00:00
matz 4b33ed994b * string.c (str_new4): should share shared instance if it already
exists.  [ruby-dev:23665]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-05 02:33:01 +00:00
matz 6a60393280 * range.c (range_each_func): terminates loop if generating value
is same to @end.  [ruby-talk:100269]

* string.c (rb_str_new4): should not reuse frozen shared string if
  the original is not an instance of String. [ruby-talk:100193]

* time.c (time_mdump): preserve GMT bit in the marshal data.
  [ruby-talk:100213]

* eval.c (is_defined): do not protect exception during receiver
  evaluation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-14 16:39:15 +00:00
matz 1b0f90ca33 * parse.y (string_content): turn off NODE_NEWLINE flag to avoid
unnecessary line trace for inlined expression.
  (ruby-bugs PR#1320)

* numeric.c (flo_to_s): tweak output string based to preserve
  decimal point and to remove trailing zeros.  [ruby-talk:97891]

* string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM
  search.  [ruby-talk:97342]

* hash.c (rb_hash_equal): returns true if two hashes have same set
  of key-value set.  [ruby-talk:97559]

* hash.c (rb_hash_eql): returns true if two hashes are equal and
  have same default values.

* string.c (rb_str_equal): always returns true or false, never
  returns nil. [ruby-dev:23404]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-07 08:44:24 +00:00
nobu d952e33003 * array.c, enum.c, eval.c, file.c, io.c, numeric.c, object.c, prec.c,
process.c, re.c, string.c: typos in RDoc comments.  [ruby-core:02783]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14 04:06:52 +00:00
matz 919f456de8 * exception message clean-up by Ian Macdonald <ian@caliban.org>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-29 07:54:38 +00:00
matz 2fab242f66 * eval.c (rb_yield_0): should not re-submit TAG_BREAK if this
yield is not break destination. [ruby-dev:23197]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-15 02:27:29 +00:00
usa d255aa7b69 * string.c (rb_str_match): raise TypeError when both arguments are
strings. [ruby-dev:22851]

* string.c (rb_str_match2): removed.

* Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub,
  wince/Makefile.sub (string.c): now not depend on version.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-10 05:36:34 +00:00
dave 349f4e7db7 Add RDoc for kernel functions, and tidy up
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-30 16:38:32 +00:00
usa 3e16f5a3f0 * string.c (rb_str_update): don't return any value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-25 13:30:39 +00:00
matz f7d46c8860 * string.c (rb_str_update): call rb_str_modify().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-25 08:49:20 +00:00
dave 2d83cd85ee MG added RDoc comments to string.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-24 21:14:46 +00:00
nobu a503181049 * string.c (rb_str_update): get rid of SEGV at just allocated String.
[ruby-core:01812]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-30 00:35:28 +00:00
usa 81160e93c9 * string.c: add #include "version.h". this file still depends on it.
* Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub,
  wince/Makefile.sub: add version.h dependency to string.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-05 02:15:27 +00:00
eban da191c4547 * class.c, hash.c, string.c: remove #include "version.h".
* Makefile.in: remove needless version.h dependency.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-04 14:40:30 +00:00
matz a4934a42cb * io.c (read_all): fptr->f may be NULL, if IO is closed in the
signal handler.

* io.c (io_read): ditto.

* string.c (get_pat): remove 1.8.0 warning code.

* string.c (rb_str_match): extend warning until 1.8.2.

* string.c (rb_str_match2): ditto.

* class.c (class_instance_method_list): remove 1.8.0 warnings.
  method_list now recurs.  [ruby-dev:21816]

* class.c (rb_obj_singleton_methods): ditto.

* array.c (rb_ary_select): remove select with block.
  [ruby-dev:21824]

* hash.c (rb_hash_select): ditto.

* hash.c (env_select): ditto.

* re.c (match_select): ditto.

* struct.c (rb_struct_select): ditto.

* process.c (check_uid_switch): remove duplicated error messages.

* process.c (check_gid_switch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-04 09:13:57 +00:00
knu fe85bcd644 * string.c (rb_str_hash): Update the HASH_PERL alternative hash
algorithm in sync with Perl 5.8.

* st.c (strhash): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-01 16:16:31 +00:00
matz 231d3e9654 * string.c (rb_str_upto): ("a"..."a").to_a should return [].
[ruby-core:01634]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-16 08:01:15 +00:00
matz 1184373d86 * string.c (str_new4): should not preserve FL_TAINT status in the
internal shared string. [ruby-dev:21601]

* string.c (rb_str_new4): ditto.

* eval.c: use EXIT_SUCCESS and EXIT_FAILURE for exit values.

* process.c: ditto. [ruby-dev:38521]

* lib/debug.rb (debug_command): should enter emacs mode when
  assigned any value to the environment variable "EMACS".
  On Meadow, (getenv "EMACS") is "meadow".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-13 13:05:24 +00:00
matz c492b9b085 * eval.c (mark_frame_adj): need to adjust argv pointer if using
system's alloca. [ruby-core:01503]

* io.c (rb_f_gets): should call next_argv() before type check
  current_file. [ruby-list:38336]

* eval.c (proc_invoke): should retrieve retval when pcall is true.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-05 05:07:54 +00:00
matz 22b955d9bf * eval.c (rb_eval): *a = [1,2] now assigns [[1,2]] to a.
consistent with *a = [1], which set [[1]] to a.

* node.h: merge NODE_RESTARY to NODE_SPLAT.

* parse.y: rules simplified a bit by removing NODE_RESTARY.

* sample/test.rb: updated for new assignment behavior.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-27 19:43:50 +00:00