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

97 Коммитов

Автор SHA1 Сообщение Дата
nobu a7b1a2eced * class.c, error.c, file.c, io.c, numeric.c, object.c, re.c, struct.c,
time.c: marked init_copy functions nodoc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-18 14:16:47 +00:00
nobu 11685dc1ee * time.c (time_overflow_p): should return results. [ruby-dev:22614]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-18 07:46:51 +00:00
siena 058fd78390 retry committing ChangeLog and time.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-18 04:11:09 +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
dave 56a0049312 Add RDoc comments for Time
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-27 06:33:45 +00:00
matz 5eaf7e5816 * gc.c (gc_mark): explicitly check mark recursion levels, instead
of unreliable stack length.

* file.c (path_check_1): honor sticky bits always.
  [ruby-talk:86273]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-28 14:23:33 +00:00
matz 90a88ab9a0 * marshal.c (r_object0): remove unnecessary iv restoration for
USRMARSHAL. [ruby-dev:21582]

* marshal.c (w_object): dump generic instance variables from
  a string from '_dump'.

* variable.c (rb_generic_ivar_table): return 0 if obj's FL_EXIVAR
  is not set.

* time.c (time_dump): copy instance variables to dumped string, to
  be included in the marshaled data.

* bignum.c (rb_big2ulong): add range check to ensure round trip.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-09 17:45:53 +00:00
matz 0b2e94b2ab * pack.c (uv_to_utf8): change message to "out of range", since
negative values are not "too big". [ruby-dev21567]

* marshal.c (w_object): should pass the value of "weak" to
  w_object().  [ruby-dev:21555] and [ruby-dev:21561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-09 06:46:40 +00:00
nobu 38d1922038 * time.c (Init_Time): define initialize. [ruby-dev:21469]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-02 09:20:31 +00:00
matz 10c4bb29b2 * time.c (time_load): restore instance variables (if any) before
loading from marshaled data.

* time.c (time_mdump): new marshal dumper. _dump is still
  available for compatibility.

* time.c (time_mload): new marshal loader.

* marshal.c (w_object): preserve instance variables for objects
  with marshal_dump.

* marshal.c (r_object0): restore instance variables before calling
  marshal_load.

* error.c (rb_warn_m): always return nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-02 08:25:00 +00:00
nobu 8695612caf * marshal.c (w_symbol, w_object): get rid of warnings.
* re.c (rb_memsearch): ditto.

* time.c (time_dump): ditto.

* ext/extmk.rb (extmake): not continue making when extconf.rb
  failed.

* ext/openssl/extconf.rb: check __VA_ARGS__ macro more precisely.

* ext/openssl/ossl.h: remove version.h dependency.

* ext/openssl/ruby_missing.h: ditto.

* lib/mkmf.rb (pkg_config): use --libs output except with
  only-L for other options.  [ruby-list:38099]

* lib/mkmf.rb (create_makefile): separate rule for static
  library from shared object.

* win32/Makefile.sub, bcc32/Makefile.sub, wince/Makefile.sub:
  define exec_prefix and libdir.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-16 14:58:34 +00:00
matz 5dd2b7102c * gcc -Wall clean-up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-24 18:33:50 +00:00
akr 41e018a46d * time.c (time_arg): initialize v[6] even when argc is 10 to
avoid valgrind error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23 04:47:30 +00:00
matz 7e35911e10 * ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)
before detach pid. [ruby-talk:71519]

* eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
  [ruby-dev:20202]

* eval.c (BEGIN_CALLARGS): restore outer block by using
  ruby_block->outer.

* eval.c (block_pass): do not alter block->prev, but block->outer.

* array.c (get_inspect_tbl): warning on wrong condition.

* eval.c (localjump_xvalue): renamed exitstatus to exit_value
  since it's not exit "status" after all.

* eval.c (localjump_error): add reason to LocalJumpError.

* compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
  is nil. now take new 2 arguments.

* time.c (time_cmp): 2003-05-16 fix was incomplete.
  (ruby-bugs-ja:PR#458)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 15:45:46 +00:00
matz 6e52d10fe6 * object.c (init_copy): rename copy_object as initialize_copy,
since it works as copy constructor.

* eval.c (rb_add_method): initialize_copy should always be
  private, like initialize.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 05:41:08 +00:00
matz 6cbcafb9b9 * eval.c (block_pass): chain previous block to the pushing block.
* time.c (time_cmp): does not compare with numbers for
  interchangeability. (ruby-bugs-ja PR#458)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-16 05:13:17 +00:00
nobu 2e10fa962f * time.c (time_strftime): RSTRING(format)->ptr might become NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-09 15:27:39 +00:00
akr 8f8a31b0e9 * time.c (make_time_t): try search_time_t if mktime/timegm is failed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-22 06:54:29 +00:00
matz 74d5623029 * variable.c (rb_obj_classname): new function.
* string.c (rb_str_dup): should preserve original's class (but not
  hidden singleton class).

* string.c (rb_str_substr): ditto.

* parse.y: backout EXPR_CMDARG removal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31 04:00:17 +00:00
matz 259ba31d8a * time.c (time_arg): was accessing garbage argv value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-23 04:25:47 +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
michal 9df466b287 Updated Copyrights of Matz to 2003.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:34:03 +00:00
usa b469f3155a * array.c (ary_alloc), dir.c (dir_s_alloc), eval.c (thgroup_s_alloc),
file.c (rb_stat_s_alloc), hash.c (hash_alloc), io.c (io_alloc),
  object.c (rb_module_s_alloc, rb_class_allocate_instance),
  re.c (match_alloc, rb_reg_s_alloc), string.c (str_alloc),
  time.c (time_s_alloc), ext/digest/digest.c (rb_digest_base_alloc),
  ext/tcltklib/tcltklib.c (ip_alloc),
  ext/win32ole/win32ole.c (fole_s_allocate, fev_s_allocate)
  : add prototype to get rid of VC++ warnings.

* ext/sdbm/init.c (fsdbm_alloc): allocator takes only one argument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-21 18:02:01 +00:00
matz bc49bc7c6b * parse.y (do_block): split "do" block and tLBRACE_ARG block.
* parse.y (cmd_brace_block): new tLBRACE_ARG block rule

* parse.y (command): can take optional cmd_brace_block; use %prec
  to resolve shift/reduce conflict. (ruby-bugs-ja PR#372)

* eval.c (ruby_finalize): trace_func should be cleared here (after
  executing exit procs and finalizers).

* eval.c (rb_define_alloc_func): new allocation framework, based
  on Nobu's work [ruby-dev:19116].  "allocate" method is no longer
  used for object allocation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20 08:33:17 +00:00
matz 60b2446bea * sprintf.c (rb_f_sprintf): preceding ".." for negative numbers
still left;  removed.

* sprintf.c (rb_f_sprintf): should not prepend '0' if width > prec
  for example "%5.3d".

* process.c (Init_process): add Process.exit and Process.abort

* pack.c (utf8_to_uv): raise ArgumentError for malformed/redundant
  UTF-8 sequences.

* process.c (last_status_set): add pid attribute to Process::Status.

* pack.c (uv_to_utf8): limit maximum length of the encoded string
  to 6 bytes, even when the platform supports 8 bytes long integers.

* pack.c (utf8_to_uv): do not decode sequences longer than 6 bytes.

* object.c (copy_object): use "copy_object" method, not "become".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-10 06:23:44 +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
michal c7e16e94e4 move struct timeval to missing.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-17 13:52:45 +00:00
eban 73d4f4b0bb * time.c (time_free): prototype; struct time_object -> void *.
avoid GCC warnings.
* lib/mkmf.rb, ext/extmk.rb ($LINK, $CPP): move to lib/mkmf.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-08 12:59:08 +00:00
usa d1a4bf7d3a * time.c: prototype; time_free() to avoid VC++ warnings.
* win32/win32.c (rb_w32_stat): remove S_IWGRP and S_IWOTH bits from
  st_mode.

* win32/win32.h (S_I*): define if not defined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-08 10:06:40 +00:00
matz 6f484e4930 * variable.c (rb_copy_generic_ivar): remove old generic instance
variable table if it existes.

	* class.c (rb_make_metaclass): metaclass of a metaclass is a
	  metaclass itself.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-03 05:20:14 +00:00
michal 0d0ae37e50 Int vs Long cleanup #3 (ruby-core:352)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-28 08:05:23 +00:00
matz c45908e41f * file.c (rb_find_file): $LOAD_PATH must not be empty.
* file.c (rb_find_file_ext): ditto.

* range.c (range_eq): class check should be based on range.class,
  instead of Range to work with Range.dup.

* range.c (range_eql): ditto.

* class.c (rb_mod_dup): need to preserve metaclass and flags.

* object.c (rb_cstr_to_dbl): had a buffer overrun.

* marshal.c (w_class): integrate singleton check into a funciton
  to follow DRY principle.

* marshal.c (w_uclass): should check singleton method.

* object.c (rb_obj_dup): dmark and dfree functions must be match
  for T_DATA type.

* object.c (rb_obj_dup): class of the duped object must be match
  to the class of the original.

* re.c (rb_reg_quote): do not escape \t, \f, \r, \n, for they are
  not regular expression metacharacters.

* time.c (time_s_alloc): use time_free instead of free (null check,
  also serves for type mark).

* time.c (time_s_at): check dfree function too.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-27 08:31:08 +00:00
michal ffc13a6525 *.c: Int vs Long cleanup
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-21 15:47:54 +00:00
matz ae23000c0e * array.c (sort_2): *a - *b may overflow.
* array.c (ary_new): len*sizeof(VALUE) may be a positive value.

* array.c (rb_ary_initialize): ditto.

* object.c (rb_class_allocate_instance): move singleton class
  check from rb_obj_alloc().

* re.c (rb_reg_initialize): should not modify frozen Regexp.

* ext/tcltklib/tcltklib.c (ip_init): allocation framework.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-19 05:56:09 +00:00
matz 2b98e10419 * eval.c (rb_undef): undef should be done for klass, not ruby_class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-31 05:18:43 +00:00
matz 34f5c4061c * range.c (range_step): iteration done using "+" if elements are
Numeric.  Otherwise using "succ".

* range.c (range_each): iteration done using "succ".  If the
  elements does not respond to "succ", raise TypeError.  As a
  result, all Enumerable methods, e.g. collect, require elements
  to respond to "succ'.

* range.c (range_member): comparison done using "each", if
  elements are non-Numeric or no-"succ" objects.  Otherwise
  compare using "<=>".

* range.c (Init_Range): remove "size" and "length".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-30 06:12:29 +00:00
eban 1715197c37 * time.c (tmcmp, search_time_t): activate unless HAVE_TIMEGM.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-29 08:42:18 +00:00
matz 4ab1577db3 * parse.y: yyparse #defines moved from intern.h
* ruby.c (proc_options): access prefixed "ruby_yydebug".

* applied modifies to pacify some of gcc -Wall warnings.

* parse.y (arg): no more ugly hack for "**", so that "-2**2" to be
  parsed as "(-2)**2", whereas "- 2**2" or "-(2)**2" to be parsed
  as "-(2**2)".

* parse.y (yylex): '-2' to be literal fixnum. [new]

* time.c (time_succ): new method for Range support.

* time.c (time_arg): nil test against v[6] (usec).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-29 05:20:39 +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 e63a990141 * re.c (rb_reg_expr_str): should treat backslash specially in
escaping.

* io.c: complete off_t handling; missing argument for
  fptr_finalize(); polished rb_scan_args call.

* dir.c: wrap multi-statment macro by do { } while (0)

* eval.c, numeric,c, sprintf.c, util.c: ditto.

* bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum,
  Bignum, nor Float.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-18 08:46:18 +00:00
matz 2bd0c2bf73 * the VMS support patch submitted by Akiyoshi, Masamichi
<Masamichi.Akiyoshi@jp.compaq.com> is merged.

* eval.c (exec_under): changing ruby_class is OK, but should not
  alter cbase.

* eval.c (yield_under_i): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-22 07:26:42 +00:00
matz d497898c23 * eval.c (cvar_cbase): utility function to find innermost non
singleton cbase.

* eval.c (is_defined): adopt new cvar behavior.

* eval.c (rb_eval): ditto.

* eval.c (assign): ditto.

* class.c (rb_mod_clone): should not call rb_obj_clone(), since
  Module does not provide "allocate".

* class.c (rb_singleton_class): should crate new singleton class
  if obj is a class or module and attached object is different,
  which means metaclass of singleton class is sought.

* time.c (time_s_alloc): now follows allocation framework.

* eval.c (rb_eval): should initialize outer class variables from
  methods in singleton class definitions.

* eval.c (assign): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-08 07:03:09 +00:00
nobu c2269d5b4f * intern.h: prototypes for new functions; rb_cstr_to_inum(),
rb_str_to_inum(), rb_cstr_to_dbl(), rb_str_to_dbl()

* bignum.c (rb_cstr_to_inum): changed from rb_cstr2inum(), and
  added argument badcheck to be consistent with parser. [new]

* bignum.c (rb_str_to_inum): ditto.

* bignum.c (rb_cstr2inum): wapper of rb_cstr_to_inum() now.

* bignum.c (rb_str2inum): ditto.

* object.c (rb_cstr_to_dbl): float number parser. [new]

* object.c (rb_str_to_dbl): ditto.

* object.c (rb_Float): use rb_cstr_to_dbl() for strict check.

* object.c (rb_Integer): use rb_str_to_inum() for strict check.

* string.c (rb_str_to_f): use rb_str_to_dbl() with less check.

* string.c (rb_str_to_i): use rb_str_to_inum() with less check.

* string.c (rb_str_hex): ditto.

* string.c (rb_str_oct): ditto.

* sprintf.c (rb_f_sprintf): ditto.

* time.c (obj2long): ditto.

* parse.y (yylex): use rb_cstr_to_inum() for strict check.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-01 10:23:22 +00:00
matz 4282698219 * time.c (time_timeval): wrong cast to time_t.
* time.c (time_plus): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-22 16:58:16 +00:00
matz 0a45dee5a5 * parse.y (str_extend): make up "#$;" handling.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-22 02:51:00 +00:00
matz 63b6b9c430 * time.c (time_plus): result should not be negative unless
NEGATIVE_TIME_T is defined.

* time.c (time_new_internal): should check tv_sec overflow too.

* time.c (time_timeval): should check time_t range when time is
  initialized from float.

* time.c (time_plus): uses modf(3).

* variable.c (rb_cvar_set): add frozen class/module check.

* variable.c (rb_cvar_declare): add frozen class/module check.

* re.c (match_to_a): should propagate taint.

* re.c (rb_reg_s_quote): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-21 09:23:28 +00:00
matz 35f851bcfe * string.c (rb_str_replace): swap arguments of OBJ_INFECT.
* eval.c (rb_thread_schedule): should not select a thread which is
  not yet initialized.

* time.c (time_plus): wrong boundary check.

* time.c (time_minus): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-18 08:47:06 +00:00
akr b48e38c526 * time.c: new method `gmtoff', `gmt_offset' and `utc_offset'.
(time_utc_offset): new function.
(Init_Time): bind above methods to `time_utc_offset'.

* time.c: 64bit time_t support.
(time_s_at): use NUM2LONG instead of NUM2INT for tv_sec.
(time_arg): initialize tm_isdst correctly.
use long to initialize tm_year.
(search_time_t): renamed from `make_time_t'.
(make_time_t): call `timegm' and `mktime' instead of `search_time_t'
if availabe.
(time_to_i): use LONG2NUM instead of INT2NUM.
(time_localtime): check localtime failure.
(time_gmtime): check gmtime failure.
(time_year): use LONG2NUM instead of INT2FIX.
(time_to_a): use long for tm_year.
(time_dump): check tm_year which is not representable with 17bit.
(time_load): initialize tm_isdst.

* configure.in: check existence of `mktime' and `timegm'.
check existence of tm_gmtoff field of struct tm.
fix negative time_t for 64bit time_t.

* missing/strftime.c: fix overflow by tm_year + 1900.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-17 06:45:37 +00:00
matz d8c75ddad3 * time.c (time_new_internal): avoid loop to calculate negative
div, mod.

* time.c (time_cmp): should handle Bignums.

* array.c (rb_ary_pop): should ELTS_SHARED flag check before
  REALLOC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-13 08:19:09 +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