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

86 Коммитов

Автор SHA1 Сообщение Дата
matz fec60bc7c4 * eval.c (avalue_to_svalue): use rb_check_array_type() again.
Clarify how "to_ary" and "to_a" work. [ruby-talk:68155]

* eval.c (svalue_to_avalue): ditto.

* eval.c (svalue_to_mrhs): ditto.

* eval.c (rb_eval): unary splat to use to_a, but we need a hack to
  exclude Object#to_a until it's removed.

* object.c (rb_Array): check obj.respond_to?("to_a").  Currently
  all object respond_to "to_a", but Object#to_a will be removed.

* range.c (Init_Range): undefine to_ary.

* re.c (Init_Regexp): ditto.

* regex.c (re_compile_pattern): do not warn if "-" is at the top
  or last of character class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-29 02:56:18 +00:00
akr 576f18654d * regex.c (re_compile_pattern): fix [:name:] handling.
/[\[:digit:]]/ was treated as /[[:digit:]]/.
  /[[:-@]/ was treated as /[\[:\-@]/.
  /[%-[:digit:]]/ was treated as /[%-\[:digit:]\]/.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-27 03:16:23 +00:00
akr 58ef7c2088 * regex.c (re_compile_pattern): fix previous change.
* instruby.rb, ext/extmk.rb, ext/tk/lib/tk.rb, lib/benchmark.rb,
  lib/cgi.rb, lib/debug.rb, lib/getoptlong.rb, lib/jcode.rb,
  lib/optparse.rb, lib/time.rb, lib/date/format.rb,
  lib/irb/ruby-lex.rb: escape `[', `]', `-' in chracter class in
  regexp to avoid warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-21 15:13:23 +00:00
matz 1714176963 * regex.c (re_compile_pattern): give warning for unescaped square
brackets and minus in character class. [ruby-dev:19868]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-21 14:37:32 +00:00
matz d35979cdfe * parse.y: tMINUS should have lower precedence than tPOW.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-24 09:18:04 +00:00
matz affe49b23b * parse.y (arg): syntaxify tPOW negative number hack.
* parse.y (negate_lit): new function to negate literal numeric
  values in compile time.

* regex.c (re_match_exec): charset info may be stored in MBC
  region when $KCODE != NONE.

* error.c (set_syserr): should preserve duplicated error names.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-23 03:39:25 +00:00
matz d242ae60d8 * regex.c (is_in_list): should work weill with UTF-8.
* regex.c (re_match_exec): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-20 08:29:24 +00:00
nobu afc6ad0561 * regex.c (re_match):
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-02 16:56:16 +00:00
matz 1b07582fcc * regex.c (re_match_exec): fix odd \G behavior based on the patch
from Nobu.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-25 07:44:33 +00:00
matz e2d384d628 * file.c (rb_find_file_ext): should not terminate searching with
empty path, just ignore.

* dir.c: remove <sys/parm.h> inclusion.

* compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using
  rb_cmpint().

* error.c (init_syserr): remove sys_nerr dependency.

* numeric.c (num_cmp): added to satisfy Comparable assumption.

* eval.c (rb_add_method): "initialize" should be public if it is a
  singleton method.

* regex.c (re_match): avoid dereferencing if size == 0.
  (ruby-bugs-ja:PR#360)

* time.c (time_cmp): should return nil if an operand is not a
  number nor time. (ruby-bugs-ja:PR#359)

* file.c (rb_stat_cmp): should return nil if an operand is not
  File::Stat.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-22 09:14:24 +00:00
matz 7c4d1fe5e0 * regex.c (re_match): p1 may exceed pend limit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-26 00:48:33 +00:00
nobu 12852c2e9a * dir.c (glob_helper): must not closedir() when exception raised
while globbing "**".

* marshal.c (w_uclass): unused variable.

* re.c (match_clone): unused.

* regex.c (re_compile_pattern): get rid of implicit promotion from
  plain char to int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-25 14:52:37 +00:00
nobu aa79984980 * parse.y (read_escape): deny zero-width hexadecimal character.
(ruby-bugs-ja:PR#260)

* parse.y (tokadd_escape): ditto.

* regex.c (re_compile_pattern): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-14 06:27:18 +00:00
matz edbe98d848 * object.c (Init_Object): should do exact match for Module#==.
* compar.c (cmp_eq): returns 'false' if <=> returns 'nil'.

* compar.c (cmp_gt,cmp_ge,cmp_lt,cmp_le,cmp_between): ditto.

* pack.c (pack_pack): should propagate taintedness.

* pack.c (pack_unpack): ditto.

* eval.c (rb_thread_schedule): need to preserve errno before
  calling rb_trap_exec().

* regex.c (calculate_must_string): a bug in charset/charset_not
  parsing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-21 05:39:19 +00:00
matz b134b91278 * various files: macro fix-up by Michal Rokos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-25 13:57:01 +00:00
matz e3a8c62630 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
* io.c (rb_io_mode_modenum): ditto.

* gc.c (rb_memerror): rename from mem_error, and exported.

* gc.c (Init_GC): pre-allocate NoMemoryError instance.

* object.c (convert_type): error message changed from "failed to
  convert" to "cannot convert", since it does not try to convert
  if an object does not respond to the converting method.

* eval.c (block_pass): convert Method to Proc using
  rb_check_convert_type().

* object.c (rb_check_convert_type): always convert T_DATA

* eval.c (rb_thread_cleanup): should not terminate main_thread by
  Fatal error.

* regex.c (is_in_list): need to not exclude NUL and NEWLINE.

* re.c (rb_reg_expr_str): wrong backslash escapement.

* re.c (rb_reg_expr_str): do not escape embedded space
  characters.

* marshal.c (w_object): T_DATA process patch from Joel VanderWerf
  <vjoel@PATH.Berkeley.EDU>.  This is temporary hack; it remains
  undocumented, and it will be removed when marshaling is
  re-designed.

* marshal.c (r_object): ditto.

* numeric.c (num_step): Integer#step is moved to Numeric#step;
  Fixnum#step is merged into this method.

* numeric.c (int_dotimes): Fixnum#times is merged.

* numeric.c (int_upto): Fixnum#upto is merged.

* numeric.c (int_downto): Fixnum#downto is merged.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-24 04:54:16 +00:00
matz 8c3157e43f * eval.c (rb_thread_cleanup): current thread may be THREAD_STOPPED,
for example when terminated from signal handler.

* regex.c (re_compile_pattern): remove /p support.

* regex.h: ditto.

* parse.y (parse_regx): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-19 04:14:07 +00:00
nobu 40ceea0a75 * regex.c (mbc_startpos_func): VC6 seems to be unable to
understand forward declaration for static variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-25 09:08:15 +00:00
nobu 76cdd41111 * regex.c (mbc_startpos_func): shoud be static.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-25 01:08:45 +00:00
matz 43b18e733d * regex.c (re_compile_pattern): '\0111' should be '\011' plus '1',
since octal literals are formed by three digits at most.

* marshal.c (w_object): module inclusion using extend() should
  also be detected.

* eval.c (rb_eval_cmd): cbase should not be NULL; it should be
  either ruby_wrapper or Object.

* enum.c (enum_each_with_index): should return self.

* process.c (proc_setpgrp): should return value for non-void function.

* process.c (proc_getpgid): should raise exception if getpgid() return -1.

* string.c (rb_str_ljust): should return a duplicated string.

* string.c (rb_str_rjust): ditto.

* string.c (rb_str_center): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-12 09:28:50 +00:00
matz d1ca5e6d6a * eval.c (rb_eval_string_wrap): should hide the toplevel local
variable bindings by PUSH_SCOPE().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-19 04:49:27 +00:00
eban 1a7929a969 * regex.c: fix prototypes of xmalloc(), xcalloc() and xrealloc().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-19 04:25:39 +00:00
nobu beb24c5888 * regex.c (re_compile_fastmap): skip begpos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-16 00:58:51 +00:00
nobu d9b49e39b2 * regex.c (mbc_startpos): become macro.
* regex.c (euc_startpos): added for improvement.

* regex.c (sjis_startpos): ditto.

* regex.c (utf8_startpos): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-01 08:49:02 +00:00
nobu ae2d54d91d * regex.c (re_adjust_startpos): fix for SJIS.
* regex.c (mbc_startpos): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-30 07:00:58 +00:00
nobu 7ddde51c68 * regex.c (re_adjust_startpos): search start of multibyte
backward.

* regex.c (mbc_startpos): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-29 19:33:11 +00:00
matz eb9708f386 * array.c (Init_Array): remove Array#filter.
* object.c (rb_mod_initialize): should accept zero argument.

* object.c (rb_mod_cmp): should raise ArgumentError if
  inheritance/inclusion relation between two classes/modules is
  not defined. [new]

* io.c (rb_io_fsync): new method. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-23 07:30:43 +00:00
matz c9f4686694 * string.c (rb_str_new2): NULL pointer check added.
* class.c (rb_define_module_under): should locate predefined
  module using rb_const_defined_at().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-07 05:27:01 +00:00
matz 459031e5d9 * process.c (rb_f_system): abandon vfork.
* io.c (pipe_open): ditto.

* defines.h: sparc linux needs different FLUSH_REGISTER_WINDOWS

* regex.c (re_search): abandon stclass optimization.

* bignum.c (rb_cstr2inum): deny "0_".

* bignum.c (rb_cstr2inum): allow "0\n" and so on.

* error.c (rb_invalid_str): utility function to show inspect()'ed
  string.

* bignum.c (rb_cstr2inum): prints invalid strings in inspect()'ed
  format.

* object.c (rb_Float): ditto.

* object.c (rb_convert_type): no longer use rb_rescue().

* re.c (rb_reg_search): initialize taint status of match object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-04 14:15:33 +00:00
matz 2f8d3bdc21 * array.c (rb_ary_modify): should copy the internal buffer if the
modifying buffer is shared.

* array.c (ary_make_shared): make an internal buffer of an array
  to be shared.

* array.c (rb_ary_shift): avoid sliding an internal buffer by
  using shared buffer.

* array.c (rb_ary_subseq): avoid copying the buffer.

* parse.y (gettable): should freeze __LINE__ string.

* io.c (rb_io_puts): old behavoir restored.  rationale: a) if you
  want to call to_s for arrays, you can just call print a, "\n".
  b) to_s wastes memory if array (and sum of its contents) is
  huge.  c) now any object that has to_ary is treated as an array,
  using rb_check_convert_type().

* hash.c (rb_hash_initialize): now accepts a block to calculate
  the default value. [new]

* hash.c (rb_hash_aref): call "default" method to get the value
  corrensponding to the non existing key.

* hash.c (rb_hash_default): get the default value based on the
  block given to 'new'.  Now it takes an optinal "key" argument.
  "default" became the method to get the value for non existing
  key.  Users may override "default" method to change the hash
  behavior.

* hash.c (rb_hash_set_default): clear the flag if a block is given
  to 'new'

* object.c (Init_Object): undef Data.allocate, left Data.new.

* ext/curses/curses.c (window_scrollok): use RTEST().

* ext/curses/curses.c (window_idlok): ditto.

* ext/curses/curses.c (window_keypad): ditto.

* ext/curses/curses.c (window_idlok): idlok() may return void on
  some platforms; so don't use return value.

* ext/curses/curses.c (window_scrollok): ditto for consistency.

* ext/curses/curses.c: replace FIX2INT() by typechecking NUM2INT().

* parse.y (str_extend): should not process immature #$x and
  #@x interpolation, e.g #@#@ etc.

* enum.c (enum_sort_by): sort_by does not have to be stable always.

* enum.c (enum_sort_by): call qsort directly to gain performance.

* util.c (ruby_qsort): ruby_qsort(qs6) is now native thread safe.

* error.c (rb_sys_fail): it must be a bug if it's called when
  errno == 0.

* regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-10 07:18:16 +00:00
matz 54d534f043 * string.c (rb_str_chomp_bang): do smart chomp if $/ == '\n'.
* io.c (rb_io_puts): don't treat Array specially.

* bignum.c (rb_big_cmp): should convert bignum to float.

* eval.c (rb_f_eval): can't modify untainted binding.

* regex.c (re_compile_pattern): should preverve p0 value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-30 08:43:28 +00:00
matz 1fe40b7cc5 * marshal.c (r_object): better allocation type check for
TYPE_UCLASS. usage of allocation framework is disabled for now.

* variable.c (rb_class_path): Module may have subclass.

* string.c (rb_str_update): should maintain original negative
  offset.

* string.c (rb_str_subpat_set): ditto

* string.c (rb_str_aset): ditto.

* re.c (rb_reg_nth_match): should check negative nth.

* re.c (rb_reg_nth_defined): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-03 07:19:19 +00:00
matz 6767cd760a * string.c (rb_str_init): String.new() => ""
* dir.c (dir_path): new method.

* dir.c (dir_initialize): wrap DIR into struct, along with path
  information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-19 06:54:11 +00:00
matz 0f35b58a2f * ruby.c (proc_options): should not alter origargv[].
* ruby.c (set_arg0): long strings for $0 dumped core.

* ruby.c (set_arg0): use setprogtitle() if it's available.

* io.c (rb_io_popen): accept integer flags as mode.

* file.c (rb_find_file_ext): extension table can be supplied from
  outside.  renamed.

* eval.c (rb_f_require): replace rb_find_file_noext by
  rb_find_file_ext.

* eval.c (rb_provided): should also check feature without
  extension.

* numeric.c (flo_to_s): do not rely on decimal point to be '.'


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-03 05:37:42 +00:00
matz c786866812 * range.c (range_step): 'iter' here should be an array.
* marshal.c (w_object): should retrieve __member__ data from
  non-singleton class.

* variable.c (rb_cvar_get): class variable override check added.

* variable.c (rb_cvar_set): ditto

* variable.c (rb_cvar_declare): ditto.

* parse.y (parse_regx): handle backslash escaping of delimiter here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-20 04:29:58 +00:00
usa 2d84b42b00 * ruby.h: enable volatile directive with VC++.
* regex.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-19 02:46:28 +00:00
matz f35971afdf * regex.c (NUM_FAILURE_ITEMS): was confusing NUM_REG_ITEMS and
NUM_NONREG_ITEMS, which have happened to be same value.

* class.c (rb_class_new): subclass check moved to this function.

* class.c (rb_class_boot): check less version of rb_class_new().

* eval.c (proc_invoke): should preserve iter status for embedded
  frame in the block.

* file.c (rb_file_s_expand_path): may overrun buffer on stack.

* string.c (rb_str_insert): forgot to call rb_str_modify().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-18 05:56:05 +00:00
matz 03d1c9cd82 * regex.c (re_search): should consider reverse search.
* dir.c (dir_s_chdir): warn only when invoked from multiple
  threads or block is not given.

* object.c (rb_convert_type): should use rb_rescue(), not rb_rescue2().

* range.c (range_init): ditto.

* object.c (rb_obj_dup): should free generic_ivar if original owns
  them.

* string.c (rb_str_each_line): should propagate taint mark.

* ext/nkf/nkf.c (rb_nkf_kconv): ditto.

* eval.c (rb_f_require): revamp for simpler implementation.

* file.c (rb_find_file_noext): use String object, instead of
  passing char* around.

* file.c (rb_find_file): ditto.

* dln.c (dln_load): should use NSLINKMODULE_OPTION_BINDNOW.

* ruby.c (load_file): local variables 'c' remain uninitialized on
  xflag.

* regex.c (re_match): prefetched escaped character too early.

* eval.c (rb_call0): add argument check for attr_readers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-14 15:17:19 +00:00
knu cbc3756009 * It is confusing to put the GPL license terms in the file COPYING;
Rename the files COPYING and COPYING.LIB to GPL and LGPL, respectively.

* While I am here, update the LGPL with the "Lesser" one.

* Move the "copying" sections of the files README and README.jp to
  COPYING and COPYING.jp, respectively.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-11 19:25:52 +00:00
matz ffe1cf575e * error.c (exc_exception): clone the receiver exception instead of
creating brand new exception object of the receiver.

* eval.c (rb_eval_string_wrap): extend new ruby_top_self, not
  original self.

* eval.c (rb_eval_cmd): respect ruby_wrapper if set.

* eval.c (eval): do not update ruby_class unless scope is not
  provided.

* eval.c (eval): preserve wrapper information.

* eval.c (proc_invoke): ditto.

* eval.c (block_pass): ditto.

* parse.y (void_expr): too much warnings for void context
  (e.g. foo[1] that can be mere Proc call).

* error.c (rb_name_error): new function to raise NameError with
  name attribute set.

* eval.c (rb_f_missing): set name and args in the exception
  object. [new]

* error.c (name_name): NameError#name - new method.

* error.c (nometh_args): NoMethodError#args - new method.

* lex.c (rb_reserved_word): lex_state after tRESCUE should be
  EXPR_MID.

* gc.c (add_heap): allocation size of the heap unit is doubled for
  each allocation.

* dir.c (isdelim): space, tab, and newline are no longer
  delimiters for glob patterns.

* eval.c (svalue_to_avalue): new conversion scheme between single
  value and array values.

* eval.c (avalue_to_svalue): ditto.

* eval.c (rb_eval): REXPAND now uses avalue_to_svalue(), return
  and yield too.

* eval.c (rb_yield_0): use avalue_to_svalue().

* eval.c (proc_invoke): Proc#call gives avaules, whereas
  Proc#yield gives mvalues.

* eval.c (bmcall): convert given value (svalue) to avalue.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-02 08:46:28 +00:00
matz 9d51cf8a6a * eval.c (rb_f_require): searches ".rb" and ".so" at the same
time.  previous behavior (search ".rb", then ".so") has a
  security risk (ruby-bugs#PR140).

* array.c (rb_ary_to_ary): new function to replace internal
  rb_Array(), which never calls to_a, but to_ary (rb_Array() might
  call both). [new]

* regex.c (PUSH_FAILURE_POINT): push option status again.

* regex.c (re_compile_pattern): avoid pushing unnecessary
  option_set.

* eval.c (rb_load): tainted string is OK if wrapped *and*
  $SAFE >= 4.

* eval.c (rb_thread_start_0): should not nail down higher blocks
  before preserving original context (i.e. should not alter
  original context).

* eval.c (proc_yield): new method equivalent to Proc#call but no
  check for number of arguments. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-06-19 04:35:17 +00:00
matz f0ccffd530 * eval.c (rb_load): should check if tainted even when wrap is
specified.

* regex.c (re_compile_pattern): too much optimization for the
  cases like /(.|a)b/.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-06-06 07:40:31 +00:00
matz d6c60dbf6d * variable.c (rb_mod_const_at): use hash table as internal
data. [new]

* variable.c (rb_mod_const_of): ditto.

* variable.c (rb_const_list): new function to convert internal
  data (hash table) to array of strings.

* eval.c (rb_mod_s_constants): data handling scheme has changed.

* eval.c (rb_add_method): should not call rb_secure(), for
  last_func may not be set.

* io.c (rb_io_ctl): ioctl should accept any integer within C long
  range.

* marshal.c (r_object): wrong type check for modules.

* marshal.c (w_object): should not dump anonymous classes/modules.

* io.c (rb_open_file): use rb_file_sysopen_internal() if the 3rd
  argument (permission flags) is given. [new, should be backported?]

* io.c (rb_io_mode_binmode): mode string (e.g. "r+") to flags to
  open(2).

* eval.c (rb_eval): NODE_REXPAND expand an array of 1 element as
  the element itself. [new, should be backported?]

* parse.y (ret_args): should treat "*[a]" in rhs expression as
  "a", not "[a]".

* regex.c (re_compile_pattern): should push option modifier at the
  right place.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-06-05 07:19:39 +00:00
matz abfaac7a6c * ruby.c (proc_options): unexpected SecurityError happens when -T4.
* regex.c (re_compile_pattern): * \1 .. \9 should be
  backreferences always.

* regex.c (re_match): backreferences corresponding to
  unclosed/unmatched parentheses should fail always.

* string.c (rb_str_cat): use rb_str_buf_cat() if possible. [new]

* string.c (rb_str_append): ditto.

* string.c (rb_str_buf_cat): remove unnecessary check (type,
  taint, modify) to gain performance.

* string.c (rb_str_buf_append): ditto.

* string.c (rb_str_buf_new): buffering string function. [new]

* string.c (rb_str_buf_append): ditto.

* string.c (rb_str_buf_cat): ditto.

* time.c (make_time_t): local time adjustment revised.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-30 09:12:34 +00:00
matz fd06a2a7fb * eval.c (block_pass): should not downgrade safe level.
* ext/dbm/extconf.rb: allow specifying dbm-type explicitly.

* ext/dbm/extconf.rb: avoid gdbm if possible, because it leaks
  memory, whereas gdbm.so doesn't.  potential incompatibility.

* string.c (rb_str_insert): new method.

* parse.y (yylex): lex_state after RESCUE_MOD should be EXPR_BEG.

* array.c (rb_ary_insert): new method.

* array.c (rb_ary_update): new utility function.

* io.c (set_outfile): should check if closed before assignment.

* eval.c (rb_eval): should preserve value of ruby_errinfo.

* eval.c (rb_thread_schedule): infinite sleep should not cause
  dead lock.

* array.c (rb_ary_flatten_bang): proper recursive detection.

* eval.c (yield_under): need not to prohibit at safe level 4.

* pack.c (pack_pack): p/P packs nil into NULL.

* pack.c (pack_unpack): p/P unpacks NULL into nil.

* pack.c (pack_pack): size check for P template.

* ruby.c (set_arg0): wrong predicate when new $0 value is bigger
  than original space.

* gc.c (id2ref): should use NUM2ULONG()

* object.c (rb_mod_const_get): check whether name is a class
  variable name.

* object.c (rb_mod_const_set): ditto.

* object.c (rb_mod_const_defined): ditto.

* marshal.c (w_float): precision changed to "%.16g"

* eval.c (rb_call0): wrong retry behavior.

* numeric.c (fix_aref): a bug on long>int architecture.

* eval.c (rb_eval_string_wrap): should restore ruby_wrapper.

* regex.c (re_compile_pattern): char class at either edge of range
  should be invalid.

* eval.c (handle_rescue): use === to compare exception match.

* error.c (syserr_eqq): comparison between SytemCallErrors should
  based on their error numbers.

* eval.c (safe_getter): should use INT2NUM().

* bignum.c (rb_big2long): 2**31 cannot fit in 31 bit long.

* regex.c (calculate_must_string): wrong length calculation.

* eval.c (rb_thread_start_0): fixed memory leak.

* parse.y (none): should clear cmdarg_stack too.

* io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on
  some platforms.

* file.c (rb_stat_dev): device functions should honor stat field
  types (except long long such as dev_t).

* eval.c (rb_mod_nesting): should not push nil for nesting array.

* eval.c (rb_mod_s_constants): should not search array by
  rb_mod_const_at() for nil (happens for singleton class).

* class.c (rb_singleton_class_attached): should modify iv_tbl by
  itself, no longer use rb_iv_set() to avoid freeze check error.

* variable.c (rb_const_get): error message "uninitialized constant
  Foo at Bar::Baz" instead of "uninitialized constantBar::Baz::Foo".

* eval.c (rb_mod_included): new hook called from rb_mod_include().

* io.c (opt_i_set): should strdup() inplace_edit string.

* eval.c (exec_under): need to push cref too.

* eval.c (rb_f_missing): raise NameError for "undefined local
  variable or method".

* error.c (Init_Exception): new exception NoMethodError.
  NameError moved under ScriptError again.

* eval.c (rb_f_missing): use NoMethodError instead of NameError.

* file.c (Init_File): should redifine "new" class method.

* eval.c (PUSH_CREF): sharing cref node was problematic.  maintain
  runtime cref list instead.

* eval.c (rb_eval): copy defn node before registering.

* eval.c (rb_load): clear ruby_cref before loading.

* variable.c (rb_const_get): no recursion to show full class path
  for modules.

* eval.c (rb_set_safe_level): should set safe level in curr_thread
  as well.

* eval.c (safe_setter): ditto.

* object.c (rb_obj_is_instance_of): nil belongs to false, not true.

* time.c (make_time_t): proper (I hope) daylight saving time
  handling for both US and Europe.  I HATE DST!

* eval.c (rb_thread_wait_for): non blocked signal interrupt should
  stop the interval.

* eval.c (proc_eq): class check aded.

* eval.c (proc_eq): typo fixed ("return" was ommitted).

* error.c (Init_Exception): move NameError under StandardError.

* class.c (rb_mod_clone): should copy method bodies too.

* bignum.c (bigdivrem): should trim trailing zero bdigits of
  remainder, even if dd == 0.

* file.c (check3rdbyte): safe string check moved here.

* time.c (make_time_t): remove HAVE_TM_ZONE code since it
  sometimes reports wrong time.

* time.c (make_time_t): remove unnecessary range check for
  platforms where negative time_t is available.

* process.c (proc_waitall): should push Process::Status instead of
  Finuxm status.

* process.c (waitall_each): should add all entries in pid_tbl.
  these changes are inspired by Koji Arai.  Thanks.

* process.c (proc_wait): should not iterate if pid_tbl is 0.

* process.c (proc_waitall): ditto.

* numeric.c (flodivmod): a bug in no fmod case.

* process.c (pst_wifsignaled): should apply WIFSIGNALED for status
  (int), not st (VALUE).

* io.c (Init_IO): value of $/ and $\ are no longer restricted to
  strings.  type checks are done on demand.

* class.c (rb_include_module): module inclusion should be check
  taints.

* ruby.h (STR2CSTR): replace to StringType() and StringTypePtr().

* ruby.h (rb_str2cstr): ditto.

* eval.c (rb_load): should not copy topleve local variables.  It
  cause variable/method ambiguity.  Thanks to L. Peter Deutsch.

* class.c (rb_include_module): freeze check at first.

* eval.c (rb_attr): sprintf() and rb_intern() moved into
  conditional body.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-02 04:22:21 +00:00
matz 8be410f065 * io.c (rb_io_ctl): do not call ioctl/fcntl for f2, if f and f2
have same fileno.

* eval.c (rb_load): raise LocaJumpError if unexpected local jumps
  appear during load.

* ext/socket/socket.c (bsock_close_read): don't call rb_thread_fd_close();
  it's supposed to be called by io_io_close().

* ext/socket/socket.c (bsock_close_read): do not modify f and f2.

* ext/socket/socket.c (bsock_close_write): ditto.

* ext/socket/socket.c (sock_new): avoid dup(2) on sockets.

* parse.y (primary): preserve and clear in_single and in_def using
  stack to prevent nested method errors in singleton class bodies.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-02-13 05:09:11 +00:00
matz ae5cb89708 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-11-10 08:52:23 +00:00
matz 087c83d7ce matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-11-10 07:16:52 +00:00
matz 9a46002fc0 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-10-02 07:48:42 +00:00
matz 3df207c883 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-09-27 03:43:15 +00:00