summaryrefslogtreecommitdiff
path: root/range.c
AgeCommit message (Collapse)Author
2015-10-28NameError#receiver of uninitialized constantnobu
* error.c (name_err_mesg_to_str): quote the name if unprintable. * object.c (check_setter_id): use rb_check_id to convert names. * variable.c (uninitialized_constant): use NameError::message to keep the receiver of uninitialized constant. [Feature #10881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-15range.c: call range_include directly if possiblenobu
* range.c (range_eqq): trivial optimization to jump to range_include directly if the method is not redefined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15range.c: move String specific codenobu
* range.c (range_include): call rb_str_include_range_p on String. * string.c (str_upto_each): extract from rb_str_upto. * string.c (rb_str_include_range_p): move String specific code from Range#include? in range.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15range.c: r_lessnobu
* range.c (r_less): merge r_le() and r_lt() and make code shorter with less branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15range.c: r_cover_pnobu
* range.c (r_cover_p): extract from range_cover and share with range_include. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-03range.c: covered for linear objectsnobu
* range.c (linear_object_p, range_include): test if covered for linear objects. [ruby-core:69052] [Bug #11113] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-01range.c: predefined IDsnobu
* range.c (id_cmp, id_succ): use predefined IDs in id.def. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-14use frozen string of symbolsnobu
* range.c (range_step, range_each): String#upto should never modifies the receiver, use frozen strings to enumerate symbols. * re.c (reg_operand): matching target is not modified. * ext/socket/constants.c (constant_arg): str_to_int never modifies argument strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16use rb_funcallvnobu
* use rb_funcallv() for no arguments call instead of variadic rb_funcall(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-13range.c: trivial optimizationsnobu
* range.c (range_bsearch): trivial optimizations, for Fixnum, and by keeping the last satisfied element. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-13range.c: class name encodingnobu
* range.c (range_bsearch): preserve encoding of class name in an exception message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-13range.c: reduce argument evaluationsnobu
* range.c (BSEARCH_CHECK): get rid of conversion of the argument multiple times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14range.c: unused functionnobu
* range.c (SET_EXCL): remove no longer used function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14[DOC] add links to `Object#hash`nobu
add links to `Object#hash` to each #`hash` methods rdocs. [Fixes GH-567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15Range#bsearch: fix typo in rdocmarcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14* enum.c: Enumerable#{min,min_by,max,max_by} extended to take anakr
optional argument. (nmin_cmp): New function. (nmin_block_cmp): Ditto (nmin_filter): Ditto. (nmin_i): Ditto. (nmin_run): Ditto. (enum_min): Call nmin_run if the optional argument is given. (nmin_max): Ditto. (nmin_min_by): Ditto. (nmin_max_by): Ditto. * range.c: Range#{min,max} extended to take an optional argument. (range_min): Call range_first if the optional argument is given. (range_max): Call rb_call_super if the optional argument is given. [ruby-core:57111] [Feature #8887] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09* range.c (Range#size): [DOC] improve description and add examples.eregon
Patch by @skade. [Fixes GH-501] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03hash.c: detect recursion for allnobu
* hash.c (rb_hash): detect recursion for all `hash' methods. each `hash' methods no longer need to use rb_exec_recursive(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30range.c: revert the old behaviornobu
* range.c (range_each): revert the old behavior, no block is given to the yielded block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29vm_eval.c: rb_yield_blocknobu
* vm_eval.c (rb_yield_block): yield block with rb_block_call_func arguments. * range.c (range_each): use rb_yield_block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLISTnobu
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration argument list of rb_block_call_func. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29array.c, enum.c, range.c: rb_block_call_func compatiblenobu
* array.c (take_i), range.c (first_i): make rb_block_call_func compatible. * enum.c (collect_all, DEFINE_ENUMFUNCS): add blockarg. * enum.c ({min,max,minmax,chunk,slicebefore}_ii): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29ruby/ruby.h: add blockarg to rb_block_call_funcnobu
* include/ruby/ruby.h (rb_block_call_func): add blockarg. block function can take block argument, e.g., proc {|&blockarg| ...}. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26should not ignore the rest of recursive constructsnobu
* array.c (rb_ary_hash): should not ignore the rest of recursive constructs. * hash.c (rb_hash_hash): ditto. * range.c (range_hash): ditto. * struct.c (rb_struct_hash): ditto. * test/-ext-/test_recursion.rb (TestRecursion): separate from test/ruby/test_thread.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-26range.c: modify checknobu
* range.c (range_initialize_copy): disallow to modify after initialized. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-25range.c: fix int and VALUEnobu
* range.c (SET_EXCL): set boolean always. * range.c (range_init): fix int flag and boolean VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-25range.c: setter macrosnobu
* range.c (RANGE_SET_{BEG,END,EXCL}): add setter macros which wrap RSTRUCT_SET() and index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08range.c: revert r42400nobu
* range.c (range_last): revert r42400. [Bug #8739] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06range.c: return nil for empty rangenobu
* range.c (range_last): return nil for empty range, or in the case the predecessor is smaller than the begin. [Bug #8739] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06range.c: consider exclusivenobu
* range.c (range_last): exclude the last number of the exclusive range if the end is Numeric. [ruby-dev:47587] [Bug #8739] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26intern.h: define rb_enumerator_size_funcnobu
* include/ruby/intern.h (rb_enumerator_size_func): define strict function declaration for rb_enumeratorize_with_size(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* include/ruby/ruby.h: support write barrier protection for T_STRUCT.ko1
Introduce the following C APIs: * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk). The type of returned pointer is (const VALUE *). * RSTRUCT_GET(st, idx) returns idx-th value of struct. * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB. And * RSTRUCT_PTR(st) returns pointer with shady operation. The type of returned pointer is (VALUE *). * struct.c, re.c, gc.c, marshal.c: rewrite with above APIs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02* range.c: Fix rdoc on Range#bsearch [Bug #8242] [ruby-core:54143]zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19fix typos. Patch by k_takata.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko1
See this ticet about RGENGC. * gc.c: Add several flags: * RGENGC_DEBUG: if >0, then prints debug information. * RGENGC_CHECK_MODE: if >0, add assertions. * RGENGC_PROFILE: if >0, add profiling features. check GC.stat and GC::Profiler. * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0). * array.c: add write barriers for T_ARRAY and generate sunny objects. * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if you want to access raw pointers. If you modify the contents which pointer pointed, then you need to care write barrier. * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects. * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX and generate sunny objects. * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write barriers for T_RATIONAL and generate sunny objects. * internal.h: add write barriers for RBasic::klass. * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects. * object.c (rb_class_allocate_instance), range.c: generate sunny T_OBJECT objects. * string.c: add write barriers for T_STRING and generate sunny objects. * variable.c: add write barriers for ivars. * vm_insnhelper.c (vm_setivar): ditto. * include/ruby/ruby.h, debug.c: use two flags FL_WB_PROTECTED and FL_OLDGEN. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED): move flag bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-06prefix global symbolsnobu
* iseq.c (rb_insn_operand_intern): prefix global symbols. * numeric.c (ruby_num_interval_step_size): ditto. * vm_backtrace.c (rb_vm_backtrace_str_ary), (rb_vm_backtrace_location_ary, rb_vm_thread_backtrace), (rb_vm_thread_backtrace_locations): ditto. * vm_trace.c (rb_vm_trace_mark_event_hooks): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05* range.c: Use div instead of / for bsearchmarcandre
* test/ruby/test_range.rb: Test showing bug when requiring mathn git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30ChangeLog, range.c: adjust indent and stylenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30* array.c (rb_ary_bsearch): Fix r38986 (typo) [Bug #7726]marcandre
* range.c (range_bsearch): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30* array.c (rb_ary_bsearch): Fix r38986 (missing whitespace)marcandre
* range.c (range_bsearch): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30* array.c (rb_ary_bsearch): Raise TypeError on bad return from blockmarcandre
* range.c (range_bsearch): ditto * test/ruby/test_array.rb (class): Test for above * test/ruby/test_range.rb (class): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30* range.c: Restrict bsearch to integers [#7728]marcandre
* test/ruby/test_range.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30* array.c (rb_ary_bsearch): Return enumerator if no block [#7725]marcandre
* range.c (range_bsearch): ditto * test/ruby/test_array.rb: Test for above * test/ruby/test_range.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29* range.c: Fix Range#bsearch for floats [Bug #7724]marcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29use RB_TYPE_Pnobu
* enumerator.c (enumerator_initialize), eval.c (rb_using_refinement), (add_activated_refinement), numeric.c (num_interval_step_size), parse.y (arg, match_op_gen, cond0), range.c (range_bsearch), vm_insnhelper.c (vm_get_iclass): use RB_TYPE_P() to optimize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02* array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,ko1
range.c: use prepared IDs. A patch from charliesome (Charlie Somerville). [Bug #7495] * common.mk: add dependency to id.h. * common.mk: replace ID_H_INCLUDES with id.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21* range.c (rb_range_beg_len): Fix potential bug for limit case [#6203]marcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e