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

205 Коммитов

Автор SHA1 Сообщение Дата
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
naruse f03642038e * marshal.c (r_object0): should return real object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 16:26:08 +00:00
nobu 4fbc270cd5 * marshal.c (r_object0): should not shadow outer variable not to
return Qnil always.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 11:21:55 +00:00
naruse ecb962058a * marshal.c (r_object0): copy instance variables to new regexp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 10:43:45 +00:00
naruse 143d1d840d * marshal.c (r_object0): set encoding only if the encoding is not US-ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 05:51:17 +00:00
naruse f69af8e877 Remove debug print.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-09 16:02:02 +00:00
naruse e6989a7ec2 * marshal.c (r_object0): replace \u by u when the regexp is
made by Ruby 1.8. [ruby-dev:36750]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-09 14:47:22 +00:00
nobu 4bef732db1 * marshal.c (w_encoding): encodings need extra depth.
[ruby-core:24100]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 23:46:20 +00:00
nobu d70719b061 * marshal.c (r_ivar): should not set internal encoding ivar as an
ordinary ivar.  [ruby-dev:38596]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-13 00:58:30 +00:00
matz 7afe0c92ea * marshal.c (w_encoding): more compact encoding information for
US-ASCII and UTF-8.  [incompatible] [experimental]

* marshal.c (r_ivar): restore :E encoding information.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-27 16:31:51 +00:00
nobu 8e86bd59c0 * common.mk (bignum.o, numeric.o): depend on util.h.
* bignum.c, marshal.c: fixed types.

* numeric.c (infinite_value): use ruby_div0.

* include/ruby/util.h (ruby_div0): moved from marshal.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-26 04:58:15 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu 080525aa68 * marshal.c (div0), numeric.c (infinite_value): new functions to
get rid of VC divion by 0 warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:09:15 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
knu df0f575e1d Fix grammos regarding the verb "refer".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 08:55:40 +00:00
nobu 1d54761948 * marshal.c (marshal_dump): fixed for check_dump_arg.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-01 10:11:51 +00:00
nobu 7558136984 * marshal.c (marshal_dump): initializes dump_arg before any funcall.
[ruby-dev:36648]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-01 09:57:38 +00:00
ko1 69029b90fe * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
to rb_gc_register_mark_object().
* eval.c, vm.c: initialize vm->mark_object_ary at
  Init_top_self().
* bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c,
  io.c, load.c, marshal.c, rational.c, ruby.c, vm.c:
  use rb_gc_register_mark_object() instead of
  rb_global_variable() or rb_gc_register_address().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:59:14 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
nobu 14cf8d09ca * marshal.c (struct load_arg): data is now st_table.
* marshal.c (mark_load_arg): marks data and compat_tbl.

* marshal.c (r_object0): no need to check if reentered.

* marshal.c (marshal_load): make the wrapper with mark_load_arg.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-02 02:47:38 +00:00
nobu 5f9c188d97 * include/ruby/ruby.h (rb_intern_const): tiny optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
shugo 38c94fa149 * marshal.c (marshal_load): set arg.untrust properly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 09:42:22 +00:00
shugo f433d710d0 * object.c (rb_obj_untrusted): new method Object#untrusted?.
(rb_obj_untrust): new method Object#untrust.
  (rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
  string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
  ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
  test/ruby/test_object.rb, test/ruby/test_string.rb,
  test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
  Object#untrusted?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:25:05 +00:00
nobu 3916eb783c * marshal.c (dump_ensure), process.c (run_exec_dup2),
string.c (rb_str_replace), transcode.c (transcode_dispatch): fixed
  memory leaks.  based on patches from shinichiro.h <shinichiro.hamaji
  AT gmail.com> at [ruby-dev:35751].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 05:08:57 +00:00
nobu f94f8f351e * configure.in (sizeof ptrdiff_t): check for size of ptrdiff_t.
* include/ruby/ruby.h (PRI?PTRDIFF, PRI?SIZE): printf conversion
  specifiers for ptrdiff_t and size_t/ssize_t.

* insns.def (leave), marshal.c (long_toobig), transcode.c
  (str_transcode), vm_dump.c (control_frame_dump, stack_dump_each),
  (debug_print_register, debug_print_pre): t and z length modifiers
  are C99.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-12 13:17:29 +00:00
akr 340cd503a7 * include/ruby/ruby.h (struct RRegexp): new field usecnt. replace
str and len by src.

* gc.c (gc_mark_children): mark src field of regexp.
  (obj_free): don't free str field.

* re.c (REG_BUSY): removed.
  (rb_reg_initialize): prohibit re-initialize regexp.
  (rb_reg_search): use usecnt to prevent freeing regexp currently
  using.  this prevents SEGV by:
    r = /\A((a.)*(a.)*)*b/
    r =~ "ab" + "\xc2\xa1".force_encoding("euc-jp")
    t = Thread.new { r =~ "ab"*8 + "\xc2\xa1".force_encoding("utf-8")}
    sleep 0.2
    r =~ "ab"*8 + "\xc2\xa1".force_encoding("euc-jp")



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-28 12:25:45 +00:00
nobu 02337b089e * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
public methods only.  [ruby-core:17283]

* object.c (convert_type): ditto.

* lib/singleton.rb (Singleton#_dump): conversion method should be
  public.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-18 03:05:33 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
mame 41a1a4ed76 * marshal.c (w_object): add a check for modification of array during
its dump.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-02 15:29:11 +00:00
naruse ccb61351ea * rational.c (string_to_r_internal): use rb_isdigit.
* marshal.c (long_toobig): use %zd.

* ruby.c (set_arg0): move unused variable definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 18:23:10 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
nobu de9d25c544 * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
private methods too.  [ruby-dev:34671]

* object.c (convert_type): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-28 03:52:44 +00:00
nobu 2b791b2ddd * marshal.c (check_dump_arg, check_load_arg): check if reentered.
[ruby-dev:34802]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 11:20:56 +00:00
matz 4a407ec3a7 * marshal.c (w_object): add volatile to avoid potential GC bug. a
patch from Tomoyuki Chikanaga <chikanag at nippon-control-system.co.jp>
  in [ruby-dev:34311].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-10 23:10:49 +00:00
akr 7132a4f979 * marshal.c (w_object): TYPE_USERDEF assigns id for ivars first.
[ruby-dev:34159] by nagachika.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-10 08:41:46 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
akr b58e36da4a * include/ruby/ruby.h (ROBJECT_NUMIV): renamed from ROBJECT_LEN.
(ROBJECT_IVPTR): renamed from ROBJECT_PTR.

* variable.c: follow the above renaming.

* object.c: ditto.

* gc.c: ditto.

* marshal.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-25 16:18:18 +00:00
usa 1e3aa62254 * marshal.c (r_object0): no need to call r_entry for immediate values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-31 08:31:20 +00:00
naruse b0a18f4d9f * marshal.c (r_object0): call r_entry/r_leave to call proc when TYPE_FIXNUM,
TYPE_NIL, TYPE_TRUE, TYPE_FALSE, TYPE_SYMBOL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-31 06:10:56 +00:00
akr 26b86d8a72 * marshal.c (w_object): dump string encoding in USERDEF.
[ruby-dev:33401]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-26 10:31:11 +00:00
akr f923cc360a * marshal.c (r_byte): use getbyte instead of getc.
(marshal_load): ditto.
  [ruby-dev:33264]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 16:37:53 +00:00
akr 063beac343 * encoding.c (rb_enc_internal_get_index): extracted from
rb_enc_get_index.
  (rb_enc_internal_set_index): extracted from rb_enc_associate_index

* include/ruby/encoding.h (ENCODING_SET): work over ENCODING_INLINE_MAX.
  (ENCODING_GET): ditto.
  (ENCODING_IS_ASCII8BIT): defined.
  (ENCODING_CODERANGE_SET): defined.

* re.c (rb_reg_fixed_encoding_p): use ENCODING_IS_ASCII8BIT.

* string.c (rb_enc_str_buf_cat): use ENCODING_IS_ASCII8BIT.

* parse.y (reg_fragment_setenc_gen): use ENCODING_IS_ASCII8BIT.

* marshal.c (has_ivars): use ENCODING_IS_ASCII8BIT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 02:49:01 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
nobu 8638ee26e7 * include/ruby/intern.h, re.c (rb_reg_new): keep interface same as
1.8.  [ruby-core:14583]

* include/ruby/intern.h, re.c (rb_reg_new_str): renamed, and defines
  HAVE_RB_REG_NEW_STR macro to tell if it is available.

* include/ruby/encoding.h (rb_enc_reg_new): added.

* insns.def (toregexp), marshal.c (r_object0): use rb_reg_new_str().

* re.c (rb_reg_regcomp, rb_reg_s_union): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 16:30:33 +00:00
matz c227d3feb3 * insnhelper.ci (vm_search_normal_superclass): rename function.
* insnhelper.ci (vm_search_superclass): ditto.

* proc.c (struct METHOD): rename rklass -> rclass.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-22 01:17:52 +00:00
akr a070c4fbe3 * configure.in: check struct timespec, clock_gettime, utimensat,
struct stat.st_atim,
  struct stat.st_atimespec,
  struct stat.st_atimensec,
  struct stat.st_mtim,
  struct stat.st_mtimespec,
  struct stat.st_mtimensec,
  struct stat.st_ctim,
  struct stat.st_ctimespec,
  struct stat.st_ctimensec.

* include/ruby/missing.h: provide struct timespec if not available.

* time.c: support nanosecond-resolution using struct timespec.

* include/ruby/intern.h: provide rb_time_nano_new.

* file.c (utime_internal): use utimensat if available.
  (rb_file_s_utime): refactored.
  (rb_f_test): use stat_atime, stat_mtime, stat_ctime.
  (rb_stat_cmp): check tv_nsec.
  (stat_atimespec): new function.
  (stat_atime): ditto.
  (stat_mtimespec): ditto.
  (stat_mtime): ditto.
  (stat_ctimespec): ditto.
  (stat_ctime): ditto.
  (rb_stat_atime): use stat_atime.
  (rb_file_s_atime): ditto.
  (rb_file_atime): ditto.
  (rb_stat_mtime): use stat_mtime.
  (rb_file_s_mtime): ditto.
  (rb_file_mtime): ditto.
  (rb_file_ctime): use stat_ctime.
  (rb_file_s_ctime): ditto.
  (rb_stat_ctime): ditto.

* variable.c (rb_copy_generic_ivar): clear clone's instance variables
  if obj has no instance variable.

* marshal.c (w_object): dump instance variables of generated string
  for TYPE_USERDEF, even if original object has instance variables.

* lib/time.rb (Time#xmlschema): use nsec instead of usec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 09:09:38 +00:00
akr 30e97cbb8b * marshal.c (mark_dump_arg): it may be called after dump_ensure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-18 11:50:25 +00:00
ko1 25c0cb981a * include/ruby/ruby.h: introduce 2 macros:
RFLOAT_VALUE(v), DOUBLE2NUM(dbl).
  Rename RFloat#value -> RFloat#double_value.
  Do not touch RFloat#double_value directly.
* bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c,
  pack.c, parse.y, process.c, random.c, sprintf.c, string.c,
  time.c: apply above changes.
* ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13 16:00:53 +00:00
matz 4ab384be2d * test/ruby/test_basicinstructions.rb: updated for new class
behavior.  [ruby-dev:32192]

* encoding.c (enc_name): Encoding should not rely on ENCODING in
  the FL_USERS flags.

* encoding.c (rb_enc_from_encoding): do not call rb_enc_associate
  for encoding itself.

* encoding.c (enc_register_at): ditto.

* marshal.c (r_ivar): do not set real instance variable for
  encoding data associated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 04:37:36 +00:00
ko1 9a0e440b81 * marshal.c (w_object): should be SPECIAL_CONST_P() instead of
IMMEDIATE_P().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 01:39:56 +00:00