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

356 Коммитов

Автор SHA1 Сообщение Дата
nobu 86bbfdadf3 * hash.c (recursive_hash): hash value of emptied hash should be
equal to an empty hash.  [ruby-core:38650]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 03:03:18 +00:00
drbrain b57a0d44f9 * hash.c: Document ENV
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 00:20:15 +00:00
drbrain 926301969f * math.c: Attach documentation for Math.
* object.c:  Document NIL, TRUE, FALSE.
	* io.c:  Improve grammar in ARGF comment.  Document STDIN/OUT/ERR.
	  Document ARGF global constant.
	* lib/rake:  Hide deprecated toplevel constants from RDoc (import from
	  rake trunk).
	* lib/thwait.rb:  Document ThWait.
	* lib/mathn.rb:  Hide Math redefinition from RDoc
	* lib/sync.rb:  Add a basic comment for Sync_m, Synchronizer_m, Sync,
	  Synchronizer.
	* parse.y:  Document SCRIPT_LINES__.
	* hash.c:  Document ENV class and global constant.
	* vm.c:  Document TOPLEVEL_BINDING.
	* version.c:  Document RUBY_* constants.
	* ruby.c:  Document DATA and ARGV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 03:09:34 +00:00
naruse 145fccbd42 * hash.c (rb_hash_reject): add documentation that Hash#reject
without block returns enumerator.
  patched by Michael Edgar [Bug #4847] [ruby-core:36800]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-26 15:45:47 +00:00
akr 5ed8c08aa0 * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
declare internal functions.

* internal.h, vm_core.h: declare internal functions.

* array.c: include internal.h.

* common.mk: update dependency for array.o.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 08:26:19 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
drbrain f6809f61d6 * hash.c (key_i): Change rdoc from "the first occurence" to "an
occurrence" since first occurrence is not a specification of
	  Hash#key.  [Ruby 1.9 - Bug #4760]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 22:35:59 +00:00
drbrain 317e2a5021 * hash.c: Improve documentation of Hash#key. Patch by Utkarsh
Kukreti.  [Ruby 1.9 - Bug #4760]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-22 23:37:03 +00:00
arton 11e4052295 * hash.c (ruby_setenv): check env process block size with OS ver.
* win32/win32.c: export rb_w32_osver for above patch.
* include/ruby/win32.h: declare rb_w32_osver for Win32 Libs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-19 16:33:59 +00:00
arton bdc8f4fca9 * hash.c: refactoring prior patch (getenvsize win32 specfic function).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-19 10:00:51 +00:00
arton 5281610f91 * hash.c (ruby_setenv): calculate total env block size for win32.
* test/ruby/test_env.rb: add test for above patch.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-19 09:28:49 +00:00
arton 812550b977 * hash.c (ruby_setenv): checking with max process environment block size fow Win32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-19 08:10:08 +00:00
usa 45f59656ae * hash.c (ruby_setenv): MSDN says that Windows XP or earlier limits
the total size of environment block to 5,120 chars.  and on such
  OS, putenv() causes SEGV.  So, ruby should limit the size of an
  environment variable to 5,120 bytes for workaround.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-08 07:52:19 +00:00
naruse 7798b9667e * hash.c (inspect_i): copy the encoding of the first key as
an initial encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15 07:08:20 +00:00
nobu 46142e472f * hash.c (rb_hash_fetch_m): use useful message for longer key, not a
nonsense id value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30 04:03:19 +00:00
kosaki 1e60af4d67 * hash.c (rb_hash_fetch_m): add GC guard to prevent intermediate
variable from GC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-27 17:36:32 +00:00
nobu 79654f3fd3 * hash.c (hash_i): return different values for inverse hash.
[ruby-core:34334]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-11 23:37:15 +00:00
akr 7b5e72c3a9 * hash.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-14 22:18:39 +00:00
nobu 2d4b0d6261 * hash.c (rb_hash_update_by): new API for Hash#update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-04 02:21:53 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
  replace calls to rb_error_frozen() with rb_check_frozen().  a
  patch from Run Paint Run Run at [ruby-core:32014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:14:05 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
ko1 261661517a * hash.c (rb_hash_aref): skip calling "default" method
if it is not neede for speed-up.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-15 15:10:17 +00:00
nobu d410639a6d * compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
  (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
  (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
  iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
  thread.c (rb_thread_local_aref),
  variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
  (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
  vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
  ext/iconv/iconv.c (map_charset): use st_data_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:47:23 +00:00
usa 85bcd25877 * hash.c (ruby_setenv): workaround for old Windows. a patch from
Heesob Park. [ruby-core:32353]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-30 01:57:17 +00:00
nobu da47bbd1db * hash.c (ruby_setenv): raise if putenv and SetEnvironmentVariable
failed, because of the restriction of the size on Windows.
  based on a patch from Peter Weldon at [ruby-core:32304].  fix:
  Bug#3812, [ruby-core:32250]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-11 07:47:44 +00:00
nobu b80d5f14df * hash.c (rb_check_hash_type): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-03 12:01:13 +00:00
marcandre c1ecff1b1e * hash.c: Documentation: change => in call-seq to ->.
* enum.c: Documentation: whitespace fix for r27865

* error.c: ditto

* file.c: ditto

* io.c: ditto

* load.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:31:22 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
marcandre b140b77926 * array.c (rb_ary_fetch, rb_ary_splice, rb_ary_store): Improve IndexError
messages [ruby-core:28394]

* hash.c (rb_hash_fetch_m): Improve KeyError message

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 04:49:53 +00:00
wanabe 1e6a884a4f * hash.c (ruby_setenv): putenv on msvcrt.dll can't remove empty value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-25 02:08:36 +00:00
nobu 4067fd028d * hash.c (rb_hash_aset): allow recursive key. [ruby-core:24648]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-17 07:25:58 +00:00
marcandre 69fd8a9011 * hash.c (Hash#merge doc): Added explanation for form with block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 17:03:48 +00:00
matz 871e9d175e * hash.c (rb_hash_select_bang): add #select! and keep_if to Hash.
* hash.c (env_select_bang): ..and to ENV.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-03 09:44:44 +00:00
mame 79afabe0c5 * hash.c (hash_update): always raise an exception when adding a new
key during iteration.  Traditionally, an exception was raised only
  when rehash occurs, but it may lead to difficult bug to reproduce.
  [ruby-core:23614]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-16 16:20:18 +00:00
nobu f3f43cdbee * array.c (rb_ary_push_m, rb_ary_unshift_m, rb_ary_aset),
(rb_ary_insert, rb_ary_replace, rb_ary_concat),
  (rb_ary_uniq_bang, rb_ary_flatten_bang): check if frozen after
  wrong number of arguments but before TypeError.
  [ruby-core:28140]

* hash.c (rb_hash_replace): ditto.

* string.c (rb_str_replace): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-10 07:31:06 +00:00
akr 96542c3678 * configure.in: test unsetenv returns a value.
unsetenv is void in older BSDs (FreeBSD 6 and OpenBSD 4.5 at least).

* hash.c (ruby_setenv): don't use the result of unsetenv if unsetenv
  doesn't return a value.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-26 12:41:43 +00:00
usa ca52e3be5c * hash.c: need to include errno.h for EINVAL.
* hash.c (ruby_setenv): fixed typo.  see [ruby-dev:40026]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12 01:00:34 +00:00
knu 217a4bd283 * hash.c (ruby_setenv): Improve the emulatation of setenv(3) on
environments where putenv(3) is used.  Raise EINVAL If a
  variable name contains an '='.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-11 13:58:59 +00:00
knu af23025d77 * hash.c (ruby_setenv): ENV.[]= should raise an error if setenv(3)
or putenv(3) fails.  [ruby-dev:40023]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-11 03:58:39 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
nobu de13a30d32 * hash.c (ruby_setenv): get rid of crash in Solaris 8 and 10.
[ruby-core:26668]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-14 07:43:26 +00:00
nobu 3f5fbc6c34 * hash.c (ruby_setenv): use ruby_strdup().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-11 03:54:04 +00:00
usa dc9112dd7a * hash.c (ruby_setenv): also set CRT workarea. ref [ruby-core:25010]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-11 03:20:21 +00:00
nobu 5b0faff44c * hash.c: use RHASH_IFNONE but not ifnone directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-08 09:13:17 +00:00
matz 327d58f720 * hash.c (default_proc_arity_check): new support function.
* hash.c (rb_hash_initialize): should do arity check as #default_proc=.
  [ruby-core:26281]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-26 10:30:15 +00:00
matz ba3bfda7a2 * hash.c (rb_hash_set_default_proc): checks arity of defalt_proc
of a Hash.  [ruby-core:26087]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 16:53:11 +00:00
naruse e0af046ad0 * hash.c (rb_f_getenv): use rb_filesystem_str_new_cstr
instead of rb_str_new2.
  ENV['PATH'].encoding should be Filesystem Encoding
  because its content is related to filesystem.
  see [ruby-dev:39393]

* hash.c (env_fetch): ditto.

* string.c (rb_filesystem_str_new): defined.

* string.c (rb_filesystem_str_new_cstr): ditto.

* include/ruby/intern.h (rb_filesystem_str_new): added.

* include/ruby/intern.h (rb_filesystem_str_new_cstr): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28 19:24:18 +00:00
nobu 9ebc378e9a * hash.c (rb_f_getenv, env_fetch): env string may be overwritten.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28 15:07:08 +00:00
marcandre 0618ca3d8d * hash.c (Hash#each): Fix documentation to reflect insertion order. A patch by Run Paint Run Run [ruby-core:23644] and [ruby-core:21231]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-24 18:56:22 +00:00
marcandre fc01d42600 * hash.c (doc): doc fix, patch by Run Paint Run Run [ruby-core:23644]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-24 18:36:52 +00:00
marcandre 1796522f10 * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to short-circuit to the outermost level in case of recursion
* test/ruby/test_thread.rb (test_recursive_outer): Test for above

* hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648]

* range.c (rb_range_hash): ditto

* struct.c (rb_struct_hash): ditto

* array.c (rb_array_hash): ditto

* test/ruby/test_array.rb (test_hash2): test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-15 21:30:50 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
matz e00b83ceb9 * hash.c (rb_hash_replace): should copy compare_by_identity status as well.
[ruby-core:24728]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 22:44:45 +00:00
yugui e1f50e2564 * hash.c (Hash::[]): rdoc. patch by Marc-Andre Lafortune.
#1385.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22 07:46:37 +00:00
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
nobu 1cd0ddea1b * hash.c (rb_hash_aset, recursive_hash): rejects recursive hash.
[ruby-core:22921]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 09:30:23 +00:00
naruse 0dc7839b7f ENV is now locale encoding.
* hash.c (env_str_new): use rb_locale_str_new instead of
  rb_tainted_str_new. rb_locale_str_new set string locale
  encoding and tainted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 15:04:33 +00:00
matz a5e227edfe * hash.c (rb_hash_hash): documentation fix. a patch from
Marc-Andre Lafortune.  [ruby-core:23943]

* object.c (rb_mod_cmp): ditto.

* range.c (range_eq): ditto.

* string.c (rb_str_partition, rb_str_rpartition): ditto.

* struct.c (rb_struct_s_def): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 21:20:44 +00:00
matz 33a8def1e1 * hash.c (rb_hash_reject_bang): always check frozen status.
[ruby-core:23715]

* hash.c (rb_hash_update): ditto.

* hash.c (rb_hash_reject_bang): call rb_hash_foreach() directly.

* hash.c (rb_hash_update_i): call st_insert() directly.

* hash.c (rb_hash_update_block_i): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-08 05:44:17 +00:00
nobu 2a6fb9690a * hash.c (Init_Hash): made #to_s an alias to #inspect to reduce
the result of recursive array.  a patch from ujihisa at
  [ruby-core:23601].  [ruby-dev:38555]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-29 08:08:25 +00:00
nobu 893349cadf * hash.c (rb_hash_inspect): rescurses with defined ID to get rid
of extra call.  [ruby-core:23601]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-29 01:04:34 +00:00
matz 844a6890c6 * st.c (st_insert2): new function with processing new key,
e.g. copy.

* hash.c (rb_hash_aset): use st_insert2() to reduce redundant
  st_lookup calls.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-27 15:56:14 +00:00
nobu 02fb261ec1 * thread.c (rb_exec_recursive_paired): new function for proper
handling of recursive arrays.  [EXPERIMENTAL] [ruby-core:23402]

* array.c (rb_ary_equal, rb_ary_eql, rb_ary_cmp): use above.

* hash.c (hash_equal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24 13:48:23 +00:00
nobu f4be2ca564 * hash.c: 3rd arguemnt of rb_hash_foreach() is VALUE.
* hash.c (rb_any_hash, recursive_hash): use VALUE for hash.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-09 03:19:52 +00:00
nobu cbc7f1b89b * hash.c (hash_foreach_iter): fix for prototype.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-26 10:29:13 +00:00
akr e279c5d6e5 * hash.c (hash_i): use Murmurhash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-15 05:59:03 +00:00
mame e722ad99d5 * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
include/ruby/intern.h: add Murmurhash API.  [ruby-dev:37784]

* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
  string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
  (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
  rational.c (nurat_hash): use Murmurhash.  [ruby-dev:37784]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
mame a48f90b05b * hash.c (rb_hash): always return a fixnum value because a return
value of rb_hash may be used as a hash value itself and bignums have
  no unique VALUE.

* test/ruby/test_hash.rb: add a test for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 18:53:40 +00:00
matz ad049bc5df * hash.c (rb_any_hash): fixed performance issues with nil, true,
false as hash keys.  a patch from Matthias Waechter.  
  [ruby-core:21568]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-26 18:48:47 +00:00
nobu 5a38751d02 * hash.c (rb_hash_s_create): set nil as the value if assoc length
is not enough.  [ruby-core:21249]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-11 00:47:32 +00:00
matz 63219d8a24 * io.c (rb_io_extract_encoding_option): "internal_encoding: nil"
to specify no-transcoding.  and other corner case fixed.
  [ruby-dev:37496]

* hash.c (rb_hash_lookup2): new function to look-up hash with
  default value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-19 08:22:45 +00:00
matz 88cab63a07 * hash.c (rb_hash_aset): string key copying only happen if key is
an exact instance of String, not a subclass. based on a patch
  from Mike Gold <mike.gold.4433 at gmail.com> in [ruby-talk:322667].
  [incompatible] [ruby-talk:322417]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-18 08:05:17 +00:00
matz 16549e33da * ext/stringio/stringio.c (strio_write): should convert writing
string to the encoding of the buffer.

* hash.c (rb_any_hash): typo fixed.

* ext/zlib/zlib.c (rb_gzwriter_write): oops, IO string conversion
  need to be done by to_s.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 14:14:13 +00:00
matz c5377c2bcc * io.c (open_key_args): should adjust argc, argv in struct
foreach_arg.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 13:57:16 +00:00
yugui 642e081879 * dln.c: Ruby no longer supports MacOS 9 or before.
* eval.c: ditto.

* eval_intern.h: ditto.

* ext/extmk.rb: ditto.

* ext/tk/sample/tkextlib/treectrl/demo.rb: ditto.

* ext/tk/stubs.c: ditto.

* file.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* vm_core.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:42:00 +00:00
yugui ae7ea3332b * dln.c: Ruby no longer supports MS-DOS.
* ext/sdbm/_sdbm.c: ditto.

* ext/sdbm/sdbm.h: ditto.

* gc.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/util.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* util.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:33:22 +00:00
matz 8bfa0ac869 * sprintf.c (rb_str_format): add %<name>s style named argument
support.  a patch from Yusuke Endoh <mame at tsg.ne.jp>
  in [ruby-dev:35851].

* sprintf.c (rb_str_format): add gettext style named format
  (%{name}) support.  inspired by [ruby-dev:35852].

* sprintf.c (GETNAMEARG): should raise KeyError exception when no
  named argument found.

* hash.c (rb_hash_fetch): export fetch function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-30 08:01:11 +00:00
akr 455fbd2373 * hash.c (rb_obj_is_proc): declaration moved for rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 09:25:27 +00:00
nobu ab279b4085 * hash.c (ENVMATCH, ENVNMATCH): reduced same code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 07:59:48 +00:00
ko1 23c291da09 * common.mk, hash.c: remove unused inclusion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 06:34:33 +00:00
matz 3256a4dc21 * hash.c (env_aset): allow nil value to remove an entry.
[ruby-dev:36465]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-22 23:27:33 +00:00
tadf 05ac51d225 * complex.c (nucomp_eql_p): new.
* complex.c (nucomp_hash): should use hash values of the elements.

	* rational.c (nurat_hash): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 04:20:46 +00:00
ko1 204929af9d * include/ruby/signal.h: removed.
* common.mk, class.c, eval.c, eval_intern.h, file.c, gc.c, hash.c,
  io.c, process.c, signal.c: vm_core.h: ditto.
  Some unused external global variables are also removed.
  (rb_prohibit_interrupt, rb_trap_immediate, rb_trap_pending,
  rb_thread_critical)
* ext/openssl/ossl_ssl.c, ext/openssl/ossl_x509store.c,
  ext/readline/readline.c, ext/socket/depend,
  ext/socket/socket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03 08:00:05 +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
matz 0cafe9e4cd * hash.c (set_default): fix rdoc. #441
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 08:19:56 +00:00
matz 8d4086d773 * hash.c (rb_hash_set_default_proc): add new method. a patch from
Giuseppe Bilotta.  #419

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 08:44:17 +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 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
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
akr cd6414267f * hash.c (hash_i): make Hash#hash order insensitive.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-07 16:19:47 +00:00
knu 80b0ef5706 * hash.c (env_each_key, env_each_value, env_reject_bang)
(rb_env_clear, env_replace): Omit duplicated secure level check.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-25 16:06:00 +00:00
knu 49cd417578 * hash.c (env_each_value): Do not call env_values() twice.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-25 15:42:14 +00:00
matz 69c213fbc7 * hash.c (rb_hash_s_create): should access converted hash value.
[ruby-dev:34555]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01 14:04:38 +00:00
nobu 30aa6b99ca * hash.c (env_delete_if): return enumerator if no block given.
[ruby-dev:34554]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01 07:10:23 +00:00
akr 514715250a * include/ruby/intern.h (rb_hash_dup): declared.
* hash.c (rb_hash_dup): new function.

* process.c (rb_spawn_internal): don't modify option hash.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 12:52:25 +00:00
akr 278b63a3e4 * include/ruby/intern.h (rb_env_clear): declared.
(rb_io_mode_modenum): declared.
  (rb_close_before_exec): declared.
  (struct rb_exec_arg): add options and redirect_fds field.
  (rb_check_argv): removed.
  (rb_exec_initarg): declared.
  (rb_exec_getargs): declared.
  (rb_exec_initarg2): declared.
  (rb_fork): add third argument: fds.

* io.c (max_file_descriptor): new static variable to record maximum
  file descriptor ruby used.
  (UPDATE_MAXFD): new macro.
  (UPDATE_MAXFD_PIPE): new macro.
  (rb_io_mode_modenum): externed.
  (rb_sysopen): update max_file_descriptor.
  (rb_close_before_exec): new function.
  (popen_exec): redirection removed because it is done by extended
  spawn mechanism.
  (pipe_open): generate a hash for spawn options to specify
  redirections.
  (pipe_open_v): use rb_exec_getargs.
  (pipe_open_s): use rb_exec_getargs.
  (rb_io_initialize): update max_file_descriptor..

* process.c (hide_obj): new function.
  (check_exec_redirect_fd): new function.
  (check_exec_redirect): new function.
  (check_exec_options_i): new function.
  (check_exec_fds): new function.
  (rb_check_exec_options): new function.
  (check_exec_env_i): new function.
  (rb_check_exec_env): new function.
  (rb_exec_getargs): new function.
  (rb_exec_initarg2): new function.
  (rb_exec_initarg): new function.
  (rb_f_exec): use rb_exec_initarg.
  (intcmp): new function.
  (run_exec_dup2): new function.
  (run_exec_close): new function.
  (run_exec_open): new function.
  (run_exec_pgroup): new function.
  (run_exec_rlimit): new function.
  (run_exec_options): new function.
  (rb_exec): call run_exec_options.
  (move_fds_to_avoid_crash): new function.
  (pipe_nocrash): new function.
  (rb_fork): use pipe_nocrash to avoid file descriptor conflicts.
  (rb_spawn): use rb_exec_initarg.
  (rlimit_resource_name2int): extracted from rlimit_resource_type.
  (rlimit_type_by_hname): new function.
  (rlimit_type_by_lname): new function.
  (rlimit_resource_type): use rlimit_type_by_hname.
  (proc_daemon): add fds argument for rb_fork.

* hash.c (rb_env_clear): renamed from env_clear and externed.

[ruby-dev:34086]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 14:46:39 +00:00
knu ac5b69acb8 * hash.c (rb_hash_delete_if, rb_hash_reject_bang, env_delete_if,
env_reject_bang): Return an enumerator if no block is given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 08:31:38 +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
matz a110ef359a * hash.c (hash_equal): two hash tables are different when internal
comparison table differ.  [ruby-dev:33989]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-04 10:19:55 +00:00