Mercurial > hg > xemacs-beta
changeset 5768:3bfcdeb65578
Return a fixnum as documented with marker arg, #'max, #'min
2013-12-15 Aidan Kehoe <kehoea@parhasard.net>
* data.c (Fmax):
* data.c (Fmin):
When an argument is a marker or a character, and WITH_NUMBER_TYPES
is defined, return a fixnum in these functions as is documented
and as the non-NUMBER_TYPES code does.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 15 Dec 2013 09:57:28 +0000 |
parents | 4e69b24a2301 |
children | ffc0c5a66ab1 |
files | src/ChangeLog src/data.c |
diffstat | 2 files changed, 25 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Mon Oct 28 16:03:53 2013 +0100 +++ b/src/ChangeLog Sun Dec 15 09:57:28 2013 +0000 @@ -1,3 +1,11 @@ +2013-12-15 Aidan Kehoe <kehoea@parhasard.net> + + * data.c (Fmax): + * data.c (Fmin): + When an argument is a marker or a character, and WITH_NUMBER_TYPES + is defined, return a fixnum in these functions as is documented + and as the non-NUMBER_TYPES code does. + 2013-09-10 Stephen J. Turnbull <stephen@xemacs.org> * font-mgr.c: Fix a bunch of comments and reformat some docstrings.
--- a/src/data.c Mon Oct 28 16:03:53 2013 +0100 +++ b/src/data.c Sun Dec 15 09:57:28 2013 +0000 @@ -1891,7 +1891,6 @@ { #ifdef WITH_NUMBER_TYPES REGISTER int i, maxindex = 0; - Lisp_Object comp1, comp2; while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0]))) args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); @@ -1901,33 +1900,33 @@ args[0] = make_fixnum (marker_position (args[0])); for (i = 1; i < nargs; i++) { - comp1 = args[maxindex]; - comp2 = args[i]; - switch (promote_args (&comp1, &comp2)) + switch (promote_args (args + maxindex, args + i)) { case FIXNUM_T: - if (XREALFIXNUM (comp1) < XREALFIXNUM (comp2)) + if (XREALFIXNUM (args[maxindex]) < XREALFIXNUM (args[i])) maxindex = i; break; #ifdef HAVE_BIGNUM case BIGNUM_T: - if (bignum_lt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2))) + if (bignum_lt (XBIGNUM_DATA (args[maxindex]), + XBIGNUM_DATA (args[i]))) maxindex = i; break; #endif #ifdef HAVE_RATIO case RATIO_T: - if (ratio_lt (XRATIO_DATA (comp1), XRATIO_DATA (comp2))) + if (ratio_lt (XRATIO_DATA (args[maxindex]), XRATIO_DATA (args[i]))) maxindex = i; break; #endif case FLOAT_T: - if (XFLOAT_DATA (comp1) < XFLOAT_DATA (comp2)) + if (XFLOAT_DATA (args[maxindex]) < XFLOAT_DATA (args[i])) maxindex = i; break; #ifdef HAVE_BIGFLOAT case BIGFLOAT_T: - if (bigfloat_lt (XBIGFLOAT_DATA (comp1), XBIGFLOAT_DATA (comp2))) + if (bigfloat_lt (XBIGFLOAT_DATA (args[maxindex]), + XBIGFLOAT_DATA (args[i]))) maxindex = i; break; #endif @@ -1988,7 +1987,6 @@ { #ifdef WITH_NUMBER_TYPES REGISTER int i, minindex = 0; - Lisp_Object comp1, comp2; while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0]))) args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); @@ -1998,33 +1996,34 @@ args[0] = make_fixnum (marker_position (args[0])); for (i = 1; i < nargs; i++) { - comp1 = args[minindex]; - comp2 = args[i]; - switch (promote_args (&comp1, &comp2)) + switch (promote_args (args + minindex, args + i)) { case FIXNUM_T: - if (XREALFIXNUM (comp1) > XREALFIXNUM (comp2)) + if (XREALFIXNUM (args[minindex]) > XREALFIXNUM (args[i])) minindex = i; break; #ifdef HAVE_BIGNUM case BIGNUM_T: - if (bignum_gt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2))) + if (bignum_gt (XBIGNUM_DATA (args[minindex]), + XBIGNUM_DATA (args[i]))) minindex = i; break; #endif #ifdef HAVE_RATIO case RATIO_T: - if (ratio_gt (XRATIO_DATA (comp1), XRATIO_DATA (comp2))) + if (ratio_gt (XRATIO_DATA (args[minindex]), + XRATIO_DATA (args[i]))) minindex = i; break; #endif case FLOAT_T: - if (XFLOAT_DATA (comp1) > XFLOAT_DATA (comp2)) + if (XFLOAT_DATA (args[minindex]) > XFLOAT_DATA (args[i])) minindex = i; break; #ifdef HAVE_BIGFLOAT case BIGFLOAT_T: - if (bigfloat_gt (XBIGFLOAT_DATA (comp1), XBIGFLOAT_DATA (comp2))) + if (bigfloat_gt (XBIGFLOAT_DATA (args[minindex]), + XBIGFLOAT_DATA (args[i]))) minindex = i; break; #endif