aboutsummaryrefslogtreecommitdiffstats
path: root/struct.c
Commit message (Collapse)AuthorAgeFilesLines
...
* * include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]marcandre2012-03-141-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * array.c: Use rb_check_arity / rb_error_arity * class.c: ditto * enumerator.c: ditto * eval.c: ditto * file.c: ditto * hash.c: ditto * numeric.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * re.c: ditto * signal.c: ditto * string.c: ditto * struct.c: ditto * transcode.c: ditto * vm_eval.c: ditto * vm_insnhelper.c: ditto & implementation of rb_error_arity * test/ruby/test_arity.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * use RB_TYPE_P which is optimized for constant types, instead ofnobu2011-09-291-6/+6
| | | | | | comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c (rb_check_trusted): new function to check an object isnobu2011-07-171-2/+1
| | | | | | | | trusted. * struct.c (rb_struct_modify), time.c (time_modify): check by the above function to show proper class names. [Bug #5036] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: add for internal use only.nobu2011-05-181-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_rand): remove unused variables.naruse2011-04-251-2/+0
| | | | | | | | | | | | | | * struct.c (rb_struct_define_without_accessor): ditto. * strftime.c (rb_strftime_with_timespec): ditto. * sprintf.c: ditto. * time.c (time_asctime): remove useless GetTimeval(). * thread_pthread.c: cast to (void *) for %p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, gc.c, hash.c, object.c, string.c, struct.c,nobu2010-10-241-1/+1
| | | | | | | | 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
* Commit miss.nobu2010-10-191-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]nobu2010-10-191-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Documentation: change => in call-seq to ->.marcandre2010-05-171-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Harmonize "#=>" in examples. [ruby-core:30206] * bignum.c: ditto * class.c: ditto * compar.c: ditto * cont.c: ditto * dir.c: ditto * encoding.c: ditto * enum.c: ditto * enumerator.c: ditto * error.c: ditto * eval.c: ditto * file.c: ditto * gc.c: ditto * io.c: ditto * load.c: ditto * marshal.c: ditto * math.c: ditto * numeric.c: ditto * object.c: ditto * pack.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * range.c: ditto * re.c: ditto * ruby.c: ditto * signal.c: ditto * sprintf.c: ditto * string.c: ditto * struct.c: ditto * thread.c: ditto * time.c: ditto * transcode.c: ditto * variable.c: ditto * vm_eval.c: ditto * vm_method.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Harmonize documentation, in particular regarding:marcandre2010-05-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* * include/ruby/ruby.h (rb_long2int): evalates the argument onlynobu2009-10-071-1/+1
| | | | | | | | | once. * struct.c (rb_struct_alloc): check array length overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_select): Struct#select should returnmatz2009-10-061-0/+1
| | | | | | enumerator when no block given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_{times, shuffle_bang, sample}): reducing macromatz2009-10-051-37/+63
| | | | | | | | | | | | | calls inside of the loop by keeping pointers in local variables. a patch from Masahiro Kanai (CanI) in [ruby-dev:39406]. It was found and fixed at Security and Programming camp 2009. * string.c (rb_str_{times, split_m}): ditto. * struct.c (rb_struct_{getmember, set, aref_id, aset_id}, {make, inspect}_struct, recursive_{equal, hash, eql}): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_equal, rb_struct_eql): Handle comparison of recursive ↵marcandre2009-09-201-12/+26
| | | | | | | | structures [ruby-core:24759] * range.c (range_eq, range_eql): ditto for ranges git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to ↵marcandre2009-09-151-7/+6
| | | | | | | | | | | | | | | | | | 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
* * include/ruby/st.h (st_hash_func): use st_index_t.nobu2009-09-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * class.c (rb_define_class_id_under, rb_define_module_id_under):nobu2009-08-121-10/+11
| | | | | | | | | | | | new functions to define a nested class/module with non-ascii name. * struct.c (make_struct): use name with encoding. * struct.c (inspect_struct): ditto. [ruby-core:24849] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (recursive_hash): extracted from rb_struct_hash. rejectakr2009-07-171-8/+17
| | | | | | | | recursive key. (rb_struct_hash): use recursive_hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24166 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (Init_Struct): made #to_s an alias to #inspect tonobu2009-05-291-1/+1
| | | | | | | | reduce the result of recursive struct. a patch from ujihisa at [ruby-dev:38554]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_long2int, RARRAY_LENINT): check long tonobu2009-05-201-3/+3
| | | | | | | | | cast to int. [ruby-dev:38508] * struct.c, vm_eval.c, vm_insnhelper.c: use RARRAY_LENINT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_new): get rid of too large alloca.nobu2009-05-201-5/+9
| | | | | | | * struct.c (rb_struct_hash): use long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (struct_ivar_get): new function to avoid repeatedmatz2009-05-191-9/+14
| | | | | | | | | | | | | | | rb_intern() calls. * struct.c (rb_struct_iv_get): use struct_ivar_get() * struct.c (num_members): ditto. * struct.c (rb_struct_s_members): ditto. * class.c (rb_singleton_class): cache symbol to reduce calls to rb_intern(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stripped trailing spaces.nobu2009-02-221-35/+35
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),mame2009-02-141-5/+6
| | | | | | | | | | | | 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
* * struct.c (rb_struct_initialize_m): avoid unnecessary arraymatz2008-11-101-8/+13
| | | | | | allocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * range.c (range_initialize_copy): Range is now a Struct.nobu2008-08-201-1/+1
| | | | | | | | | [ruby-core:18353] * struct.c (rb_struct_init_copy): made public. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (rb_obj_untrusted): new method Object#untrusted?.shugo2008-08-131-1/+1
| | | | | | | | | | | | | | | (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
* * gc.c: __size__ removed. use the length of __members__ instead.akr2008-06-271-11/+15
| | | | | | | (num_members): new function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings with -Wwrite-string.nobu2008-05-311-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_s_def): Struct.new(0) should not SEGV.matz2008-05-051-5/+7
| | | | | | | | | based on the patch from wanabe <s.wanabe at gmail.com> in [ruby-dev:34594]. * struct.c (make_struct): call to_str on name object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c (builtin_types), signal.c (siglist), st.c (primes),nobu2008-04-261-1/+1
| | | | | | | struct.c (ref_func), time.c (months): constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (make_struct): preserve encoding of struct name.nobu2008-03-051-5/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (method_name): preserve Symbol's encoding.matz2007-12-241-3/+1
| | | | | | * numeric.c (fix_id2name): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix va_start arg.akr2007-11-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_alloc_noinit): new function.akr2007-11-231-2/+11
| | | | | | | | | (rb_struct_define_without_accessor): add allocator to the arguments. * range.c (range_alloc): re-introduced using rb_struct_alloc_noinit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_define_without_accessor): new function.akr2007-11-231-0/+35
| | | | | | | | * range.c (range_alloc): removed. (Init_Range): use rb_struct_define_without_accessor. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h: export rb_ivar_foreach.akr2007-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/ruby/ruby.h: modify struct RObject and RClass for optimizing T_OBJECT space. [ruby-dev:31853] (ROBJECT_LEN, ROBJECT_PTR) (RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, RCLASS_IV_INDEX_TBL) (RMODULE_IV_TBL, RMODULE_M_TBL, RMODULE_SUPER): abstract accessor defined. * variable.c: support the modified RObject and RClass. * object.c: ditto. * class.c: ditto. * gc.c: ditto. * marshal.c: ditto. * eval_method.ci: use the abstract accessor. * insns.def: ditto. * proc.c: ditto. * struct.c: ditto. * eval.c: ditto. * error.c: ditto. * vm.c: ditto. * insnhelper.ci: ditto. * ext/digest/digest.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * marshal.c (r_object0): don't call user-defined initialize forakr2007-09-081-1/+1
| | | | | | | | | | | T_STRUCT objects. * include/ruby/intern.h (rb_struct_initialize): declared. * struct.c (rb_struct_initialize): export. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_s_members): check if __members__ is anmatz2007-09-081-0/+3
| | | | | | array to prevent segmentation fault. [ruby-dev:31759] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (rb_struct_s_members): should raise TypeError insteadmatz2007-09-071-1/+1
| | | | | | | | of call rb_bug(). [ruby-dev:31709] * marshal.c (r_object0): no nil check require any more. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c: provide basic features for M17N.matz2007-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * struct.c (rb_struct_init_copy): disallow changing the size.nobu2007-07-121-8/+3
| | | | | | | [ruby-dev:31168] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby: moved public headers.nobu2007-06-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c (inspect_struct): do not display a class name formatz2006-09-161-1/+6
| | | | | | | anonymous struct. The member fields are sufficient. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_f_local_variables): list symbols.matz2006-09-041-1/+1
| | | | | | | | | | | | | * struct.c (rb_struct_s_members_m): ditto. * variable.c (ivar_i): ditto. * variable.c (gvar_i): ditto. * variable.c (cv_i): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (Init_String): undef Symbol#new.matz2006-09-021-8/+3
| | | | | | | * struct.c (rb_struct_s_def): wrong symbol detection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ruby.h (struct RArray): embed small arrays.matz2006-09-021-27/+27
| | | | | | | | | | (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