aboutsummaryrefslogtreecommitdiffstats
path: root/compar.c
Commit message (Collapse)AuthorAgeFilesLines
* [DOC] Add doc for behavior when passing nil to Comparable#clamp(min, max)Kouhei Yanagita2023-10-251-0/+6
|
* [DOC] Correct docs for ComparableWai-Wai Ng2023-04-101-2/+2
|
* Change ArgumentError message when Comparable#clamp receives min value higher ↵Kaíque Kandy Koga2023-01-171-1/+1
| | | | than max value
* Reuse NIL_OR_UNDEF_P macroS-H-GAMELINKS2022-12-021-1/+1
|
* Using UNDEF_P macroS-H-GAMELINKS2022-11-161-1/+1
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-7/+7
| | | | [Misc #18891]
* Using RBOOL in cmp_between funcS-H-GAMELINKS2022-06-171-3/+1
|
* [DOC] Use simple references to operator methodsNobuyoshi Nakada2022-03-301-8/+4
| | | | | | | Method references is not only able to be marked up as code, also reflects `--show-hash` option. The bug that prevented the old rdoc from correctly parsing these methods was fixed last month.
* [DOC] Repair format and links in What's Here sections (#5711)Burdette Lamar2022-03-251-7/+13
| | | | | * Repair format and links in What's Here for Comparable and Array * Repair format for What's Here in enum.c
* [DOC] Simplify operator method referencesNobuyoshi Nakada2022-02-121-7/+5
|
* Refactor and Using RBOOL macroS.H2021-09-151-2/+1
|
* Using RBOOL macroS.H2021-08-021-8/+4
|
* What's Here for Numeric and ComparableBurdette Lamar2021-06-211-0/+16
|
* Don't redefine #rb_intern over and over againStefan Stüben2020-10-211-3/+0
|
* cmp_clamp: do not goto into a branch卜部昌平2020-06-291-3/+1
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* decouple internal.h headers卜部昌平2019-12-261-1/+4
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* [DOC] Improve readability of requirements for <=>Marcus Stollsteimer2019-12-231-3/+3
|
* Raise on end-exclusive ranges [Feature #14784]Nobuyoshi Nakada2019-10-261-6/+9
| | | | | Raises an error on end-exclusive ranges unless endless, regardless the receiver.
* Fixed range argument condition [Feature #14784]Nobuyoshi Nakada2019-10-251-19/+37
| | | | | Allows a beginless/endless range, and an end-exclusive range unless the receiver is smaller than its end.
* Comparable#clamp with a range [Feature #14784]Nobuyoshi Nakada2019-10-161-5/+28
|
* [DOC] fixed a variable name [ci skip]Nobuyoshi Nakada2019-10-151-6/+6
| | | | | replaced "anObject" with "obj". also marked up with simple `_`s instead of `<i>`.
* Clarify requirements of <=>Shugo Maeda2019-04-221-6/+7
| | | | | A return value of <=> is automatically converted to -1, 0, or 1, so other values can be returned. [Misc #15630]
* [DOC] fix markups [ci skip]nobu2019-03-221-10/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Comparable#clampnobu2016-08-111-0/+34
| | | | | | * compar.c (cmp_clamp): Introduce Comparable#clamp. [Feature #10594] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: utility functionsnobu2016-08-111-19/+20
| | | | | | | | * compar.c (rb_cmp): call comparison method by predefiend ID. * compar.c (cmpint): returns compared result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c: Update doc for == [#7688] [ci-skip]marcandre2015-12-151-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: variable name [ci skip]nobu2015-02-211-2/+2
| | | | | | | * compar.c (Init_Comparable): [DOC] Replace camelcase variable name. [Fix GH-833] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_equal): no more error hiding for Comparable#==.eregon2015-02-111-22/+6
| | | | | | | It now behaves as other Comparable methods. See #7688. * test/ruby/test_comparable.rb: update related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: fix messagenobu2015-01-131-1/+1
| | | | | | | * compar.c (rb_cmperr): show float values in the error message always, not only flonum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: use Module#to_snobu2014-08-211-2/+2
| | | | | | | * compar.c (rb_cmperr): use Module#to_s so that names in a message can be overridden by to_s. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: preserve encodingsnobu2014-08-191-6/+5
| | | | | | | * compar.c (rb_cmperr): preserve encodings of arguments in the message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_equal): warn for this release and still rescueeregon2014-01-181-6/+22
| | | | | | | | standard exceptions for a nicer transition. See #7688. Partly reverts r44502. * test/ruby/test_comparable.rb: adapt assertion to match new behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_equal): remove error hiding in Comparable#==.eregon2014-01-051-20/+6
| | | | | | | | | | Comparable#== no longer rescues exceptions silently. This was the cause of quite a couple bugs. See #7688. [EXPERIMENTAL] * test/ruby/test_comparable.rb: adapt assertion to match new behavior. * lib/rdoc/method_attr.rb: fix bugs discovered by this change. * test/rdoc/test_rdoc_normal_class.rb: fix bugs in tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_eq_recursive): Fix the return value, the value foreregon2013-12-281-1/+1
| | | | | | | | failed #<=> should be nil. It was raising a NoMethodError for the test case TestComparable#test_no_cmp (undefined method `>' for false:FalseClass). Yet one more reason for #7688. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: fail if recursionnobu2013-10-091-1/+8
| | | | | | | | * compar.c (cmp_eq): fail if recursion. [ruby-core:57736] [Bug #9003] * thread.c (rb_exec_recursive_paired_outer): new function which is combinnation of paired and outer variants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (Comparable#==): fix typo.eregon2013-05-061-1/+1
| | | | | | Patch by Andrew Grimm. [Fix GH-297] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: inversed comarison without infinite recursionnobu2013-02-171-0/+20
| | | | | | | | | * compar.c (rb_invcmp): compare by inversed comarison, with preventing from infinite recursion. [ruby-core:52305] [Bug #7870] * string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite recursion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_equal): Document ignored exception and return falsezzak2013-02-071-0/+3
| | | | | | | By Makoto Kishimoto [Bug #7790] [ruby-dev:46925] [ruby-dev:46910] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Documentation: change => in call-seq to ->.marcandre2010-05-171-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * string.c: rdoc for <=>, casecmpmarcandre2009-10-281-1/+3
| | | | | | | | | | | | * bignum.c: rdoc for <=> * file.c: ditto * time.c: ditto * compar.c: rdoc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stripped trailing spaces.nobu2009-02-221-12/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cmpint): moved from compar.c, to check bignummatz2008-04-061-16/+0
| | | | | | | | | zero. * range.c (range_step): add step for each iteration if begin and end are numeric. [ruby-core:15990] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15911 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
* * include/ruby/ruby.h (struct RBignum): embed digits in RBignum forakr2007-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | small bignums. * bignum.c: RBignum embeded digits implemented. * include/ruby/intern.h: declare rb_big_resize. * gc.c: don't free embedded digits. * numeric.c: replace direct bignum field accessor by abstract field accessor such as RBIGNUM(val)->sign to RBIGNUM_SIGN(val). * sprintf.c: ditto. * compar.c: ditto. * marshal.c: ditto. * random.c: ditto. * .gdbinit: support embedded small bignums. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13330 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
* * 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
* * ext/digest/digest.c (rb_digest_base_s_digest): add volatile tomatz2005-12-121-2/+2
| | | | | | | | | | | protect temporary context object. [ruby-dev:27979] * ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should be called before actual variable initialization. [ruby-dev:27986] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/dbm/test_dbm.rb: remove locking test, which may not bematz2005-09-121-1/+0
| | | | | | | supported on some platforms. [ruby-dev:27030] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e