summaryrefslogtreecommitdiff
path: root/hash.c
AgeCommit message (Collapse)Author
2008-05-25* hash.c (env_each_key, env_each_value, env_reject_bang)knu
(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* hash.c (env_each_value): Do not call env_values() twice.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01* hash.c (rb_hash_s_create): should access converted hash value.matz
[ruby-dev:34555] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01* hash.c (env_delete_if): return enumerator if no block given.nobu
[ruby-dev:34554] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26* include/ruby/intern.h (rb_hash_dup): declared.akr
* 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-24* include/ruby/intern.h (rb_env_clear): declared.akr
(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-14* hash.c (rb_hash_delete_if, rb_hash_reject_bang, env_delete_if,knu
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-03-09fix doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-04* hash.c (hash_equal): two hash tables are different when internalmatz
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* hash.c (rb_hash_aset): should not copy key string whenmatz
compare_by_identity is set. [ruby-dev:33604] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-03* hash.c (rb_any_hash): shrinks all results in Fixnum range.nobu
[ruby-core:15713] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28* string.c (str_new): remove encoding assumption of empty string.naruse
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@15635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12* string.c (rb_str_hash_cmp): lighter version of rb_str_cmp() formatz
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@15441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-05typo fixedmatz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-05* hash.c (rb_hash_flatten): do not flatten recursively by default.matz
[ruby-dev:33603] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-05* hash.c (env_rassoc): remove access to free'd environment on mswin32.mame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25* string.c (rb_str_usascii_new{,2}: defined.naruse
(rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty string. * encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined. (rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i): use rb_str_ascii_new. * array.c (recursive_join, inspect_ary): ditto. * object.c (nil_to_s, nil_inspect, true_to_s, false_to_s, rb_mod_to_s): ditto. * hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch, env_clear, env_to_s, env_inspect): ditto. * numeric.c (flo_to_s, int_chr, rb_fix2str): ditto. * bignum.c (rb_big2str): ditto. * file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname, file_inspect_join, Init_file): ditto. * test/ruby/test_ruby_m17n.rb: add checks for encoding of string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06* $Date$ keyword removed to avoid inclusion of locale dependentakr
string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-01* include/ruby/encoding.h (rb_isascii): defined.akr
(rb_isalnum): ditto. (rb_isalpha): ditto. (rb_isblank): ditto. (rb_iscntrl): ditto. (rb_isdigit): ditto. (rb_isgraph): ditto. (rb_islower): ditto. (rb_isprint): ditto. (rb_ispunct): ditto. (rb_isspace): ditto. (rb_isupper): ditto. (rb_isxdigit): ditto. (rb_tolower): ditto. (rb_toupper): ditto. * include/ruby/st.h (st_strcasecmp): declared. (st_strncasecmp): ditto. * st.c (type_strcasehash): use st_strcasecmp instead of strcasecmp. (st_strcasecmp): defined. (st_strncasecmp): ditto. * include/ruby/ruby.h: include include/ruby/encoding.h. (ISASCII): use rb_isascii. (ISPRINT): use rb_isprint. (ISSPACE): use rb_isspace. (ISUPPER): use rb_isupper. (ISLOWER): use rb_islower. (ISALNUM): use rb_isalnum. (ISALPHA): use rb_isalpha. (ISDIGIT): use rb_isdigit. (ISXDIGIT): use rb_isxdigit. (TOUPPER): defined. (TOLOWER): ditto. (STRCASECMP): ditto. (STRNCASECMP): ditto. * dir.c, encoding.c, file.c, hash.c, process.c, ruby.c, time.c, transcode.c, ext/readline/readline.c: use locale insensitive functions. [ruby-core:14662] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31fix typos.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30* hash.c (rb_hash_eql): recursive comparison should be based onmatz
eql? [ruby-core:13803] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-03* hash.c (rb_hash_each_pair): make Hash#each to be alias tomatz
Hash#each_pair for compatibility and clarity. * hash.c (env_each_pair): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-25* hash.c (rb_hash_s_create): check and convert argument hashmatz
using #to_hash. * hash.c (rb_hash_s_create): Hash#[] now takes assocs as source of hash conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-24* array.c (rb_ary_equal): should handle recursive array.matz
* hash.c (hash_equal): should handle recursive hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-24* hash.c (hash_i): avoid too frequent hash conflict where key andmatz
value are same. a patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:31802] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-20* hash.c (hash_equal): should call rb_eql when argument eql is set.matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-30* hash.c (hash_alloc0, hash_alloc): unified because hash_alloc doesn'takr
allocate st_table now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29* include/ruby/intern.h: declare rb_hash_tbl.akr
* include/ruby/ruby.h (RHash): delay st_table allocation. rename tbl field to ntbl to detect direct reference to the st_table as a compile error. (RHASH_TBL): abstract accessor defined. (RHASH_ITER_LEV): ditto. (RHASH_IFNONE): ditto. (RHASH_SIZE): ditto. (RHASH_EMPTY_P): ditto. * hash.c: delay st_table allocation. * gc.c: replace tbl by ntbl. * array.c: replace direct field accessor by abstract field accessor such as RHASH(hash)->tbl to RHASH_TBL(hash). * marshal.c: ditto. * insns.def: ditto. * ext/iconv/iconv.c: ditto. * ext/json/ext/generator/generator.c: ditto. * ext/json/ext/parser/parser.c: ditto. * ext/syck/rubyext.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25* encoding.c: provide basic features for M17N.matz
* parse.y: encoding aware parsing. * parse.y (pragma_encoding): encoding specification pragma. * parse.y (rb_intern3): encoding specified symbols. * string.c (rb_str_length): length based on characters. for older behavior, bytesize method added. * string.c (rb_str_index_m): index based on characters. rindex as well. * string.c (succ_char): encoding aware succeeding string. * string.c (rb_str_reverse): reverse based on characters. * string.c (rb_str_inspect): encoding aware string description. * string.c (rb_str_upcase_bang): encoding aware case conversion. downcase, capitalize, swapcase as well. * string.c (rb_str_tr_bang): tr based on characters. delete, squeeze, tr_s, count as well. * string.c (rb_str_split_m): split based on characters. * string.c (rb_str_each_line): encoding aware each_line. * string.c (rb_str_each_char): added. iteration based on characters. * string.c (rb_str_strip_bang): encoding aware whitespace stripping. lstrip, rstrip as well. * string.c (rb_str_justify): encoding aware justifying (ljust, rjust, center). * string.c (str_encoding): get encoding attribute from a string. * re.c (rb_reg_initialize): encoding aware regular expression * sprintf.c (rb_str_format): formatting (i.e. length count) based on characters. * io.c (rb_io_getc): getc to return one-character string. for older behavior, getbyte method added. * ext/stringio/stringio.c (strio_getc): ditto. * io.c (rb_io_ungetc): allow pushing arbitrary string at the current reading point. * ext/stringio/stringio.c (strio_ungetc): ditto. * ext/strscan/strscan.c: encoding support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-24* array.c (rb_ary_s_try_convert): a new class method to convertmatz
object or nil if it's not target-type. this mechanism is used to convert types in the C implemented methods. * hash.c (rb_hash_s_try_convert): ditto. * io.c (rb_io_s_try_convert): ditto. * re.c (rb_reg_s_try_convert): ditto. * string.c (rb_str_s_try_convert): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-21* hash.c (st_foreach_func, rb_foreach_func): typedefed.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-21* hash.c (rb_hash_clear): use st_clear() unless iterating.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-15* hash.c (rb_hash_delete_key): delete the entry without calling block.nobu
* hash.c (rb_hash_shift): should consider iter_lev too. * hash.c (delete_if_i): use rb_hash_delete_key() so that the block isn't called twice. [ruby-core:11556] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-10* hash.c (rb_hash_lookup): added. this function is similar toko1
rb_hash_aref(), but doesn't call Hash#default when no entry exists. * include/ruby/intern.h: ditto. * insnhelper.ci (lfp_svar_get): use rb_hash_lookup(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05* include/ruby/st.h, st.c (st_init_table, st_init_table_with_size):nobu
constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29* hash.c: purged trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-22* hash.c (rb_hash_assoc): new method.matz
* hash.c (rb_hash_rassoc): ditto. * hash.c (rb_hash_flatten): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-21* hash.c (rb_hash_sort): remove hash specific implementation.matz
* hash.c (rb_hash_select): returns new hash, not assoc array. * hash.c (env_select): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-15* hash.c: exchange semantics of Hash#each and Hash#each_pair.ko1
pointed out by [ruby-dev:30997]. * test/ruby/test_iterator.rb: ditto. * test/ruby/test_yield.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10* include/ruby: moved public headers.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-12* string.c (rb_str_partition): RDoc update. a patch frommatz
Mauricio Fernandez <mfp at acm.org>. [ruby-core:09160] * hash.c (rb_hash_compare_by_id): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-12* hash.c (rb_hash_compare_by_id): somehow we lost renaming frommatz
Hash#identical. [ruby-core:09163] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-25* hash.c (recursive_hash): remove unused local variable.matz
* parse.y (parser_yylex): ditto. * parse.y (rb_gc_mark_symbols): fix unmatched prototype . * file.c (rb_get_path): check NUL byte in the path string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-22* hash.c (rb_hash_eql): new method to be used by Hash.matz
* hash.c (rb_hash_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-13* hash.c (rb_hash_compare_by_identity): rename Hash#identical tomatz
Hash#compare_by_identity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-11* hash.c (rb_hash_compare_by_identity): rename Hash#identical tomatz
Hash#compare_by_identity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-11* hash.c (rb_hash_identical): a new method to make a hash tomatz
compare keys by their identity. * hash.c (rb_hash_identical_p): new method to tell if a hash is identical or not. * st.c (st_numcmp, st_numhash): export hash type functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-07* array.c (Init_Array): #to_s to be an alias to #inspect.matz
[EXPERIMENTAL] [ruby-dev:29520] * hash.c (Init_Hash): ditto. * lib/mkmf.rb (create_makefile): replace "print array" by "print *array". * mkconfig.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02* ruby.h (struct RArray): embed small arrays.matz
(RARRAY_LEN): defined for accessing array members. (RARRAY_PTR): ditto. * array.c: use RARRAY_LEN and RARRAY_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31* ruby.h (struct RString): embed small strings.matz
(RSTRING_LEN): defined for accessing string members. (RSTRING_PTR): ditto. * string.c: use RSTRING_LEN and RSTRING_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e