summaryrefslogtreecommitdiffstats
path: root/hash.c
Commit message (Collapse)AuthorAgeFilesLines
* * hash.c (Hash::[]): rdoc. patch by Marc-Andre Lafortune.yugui2009-07-221-7/+11
| | | | | | #1385. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppressed shorten-64-to-32 warnings.nobu2009-07-181-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_aset, recursive_hash): rejects recursive hash.nobu2009-07-161-1/+4
| | | | | | | [ruby-core:22921] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ENV is now locale encoding.naruse2009-07-121-1/+1
| | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@24056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_hash): documentation fix. a patch frommatz2009-07-011-2/+2
| | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_reject_bang): always check frozen status.matz2009-06-081-3/+5
| | | | | | | | | | | | | | [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: http://svn.ruby-lang.org/repos/ruby/trunk@23650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (Init_Hash): made #to_s an alias to #inspect to reducenobu2009-05-291-13/+9
| | | | | | | | the result of recursive array. a patch from ujihisa at [ruby-core:23601]. [ruby-dev:38555] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_inspect): rescurses with defined ID to get ridnobu2009-05-291-8/+12
| | | | | | | of extra call. [ruby-core:23601] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_insert2): new function with processing new key,matz2009-05-271-3/+2
| | | | | | | | | e.g. copy. * hash.c (rb_hash_aset): use st_insert2() to reduce redundant st_lookup calls. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_exec_recursive_paired): new function for propernobu2009-05-241-2/+2
| | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@23557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c: 3rd arguemnt of rb_hash_foreach() is VALUE.nobu2009-05-091-30/+47
| | | | | | | * hash.c (rb_any_hash, recursive_hash): use VALUE for hash. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (hash_foreach_iter): fix for prototype.nobu2009-02-261-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (hash_i): use Murmurhash.akr2009-02-151-2/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),mame2009-02-141-1/+1
| | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash): always return a fixnum value because a returnmame2009-02-141-5/+14
| | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@22308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_any_hash): fixed performance issues with nil, true,matz2009-01-261-0/+3
| | | | | | | false as hash keys. a patch from Matthias Waechter. [ruby-core:21568] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_s_create): set nil as the value if assoc lengthnobu2009-01-111-3/+9
| | | | | | | is not enough. [ruby-core:21249] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_encoding_option): "internal_encoding: nil"matz2008-12-191-2/+8
| | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@20870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_aset): string key copying only happen if key ismatz2008-12-181-1/+1
| | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@20860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/stringio/stringio.c (strio_write): should convert writingmatz2008-10-211-1/+1
| | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (open_key_args): should adjust argc, argv in structmatz2008-10-211-1/+1
| | | | | | foreach_arg. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dln.c: Ruby no longer supports MacOS 9 or before.yugui2008-10-041-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@19680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dln.c: Ruby no longer supports MS-DOS.yugui2008-10-041-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@19679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): add %<name>s style named argumentmatz2008-09-301-2/+8
| | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_obj_is_proc): declaration moved for rdoc.akr2008-09-231-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (ENVMATCH, ENVNMATCH): reduced same code.nobu2008-09-231-29/+12
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * common.mk, hash.c: remove unused inclusion.ko12008-09-231-1/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (env_aset): allow nil value to remove an entry.matz2008-09-221-1/+2
| | | | | | [ruby-dev:36465] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_eql_p): new.tadf2008-09-151-4/+0
| | | | | | | | | | * complex.c (nucomp_hash): should use hash values of the elements. * rational.c (nurat_hash): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/signal.h: removed.ko12008-09-031-8/+1
| | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@19080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (set_default): fix rdoc. #441matz2008-08-141-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_set_default_proc): add new method. a patch frommatz2008-08-131-0/+33
| | | | | | Giuseppe Bilotta. #419 git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (rb_obj_untrusted): new method Object#untrusted?.shugo2008-08-131-2/+2
| | | | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu2008-06-091-0/+2
| | | | | | | * *.c: no cache in init functions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-1/+1
| | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (hash_i): make Hash#hash order insensitive.akr2008-06-071-5/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (env_each_key, env_each_value, env_reject_bang)knu2008-05-251-10/+5
| | | | | | | (rb_env_clear, env_replace): Omit duplicated secure level check. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (env_each_value): Do not call env_values() twice.knu2008-05-251-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_s_create): should access converted hash value.matz2008-05-011-2/+2
| | | | | | [ruby-dev:34555] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (env_delete_if): return enumerator if no block given.nobu2008-05-011-0/+1
| | | | | | | [ruby-dev:34554] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_hash_dup): declared.akr2008-04-261-0/+13
| | | | | | | | | | * hash.c (rb_hash_dup): new function. * process.c (rb_spawn_internal): don't modify option hash. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_env_clear): declared.akr2008-04-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@16183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_delete_if, rb_hash_reject_bang, env_delete_if,knu2008-04-141-3/+7
| | | | | | | env_reject_bang): Return an enumerator if no block is given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-5/+8
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (hash_equal): two hash tables are different when internalmatz2008-03-041-0/+2
| | | | | | comparison table differ. [ruby-dev:33989] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_aset): should not copy key string whenmatz2008-03-041-6/+7
| | | | | | compare_by_identity is set. [ruby-dev:33604] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_any_hash): shrinks all results in Fixnum range.nobu2008-03-031-3/+6
| | | | | | | [ruby-core:15713] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_new): remove encoding assumption of empty string.naruse2008-02-281-3/+3
| | | | | | | | | * hash.c ( rb_f_getenv, env_fetch, env_inspect): result of ENV should be always ASCII-8BIT. * object.c (nil_to_s): nil.to_s should be US-ASCII. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_hash_cmp): lighter version of rb_str_cmp() formatz2008-02-121-1/+1
| | | | | | | | | | | hash comparison function. * hash.c (rb_any_cmp): use rb_str_hash_cmp(). * string.c (rb_str_casecmp): should return nil for incompatible comparison. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e