APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1387101448 0
# Node ID 3bfcdeb65578e17883ff14fb2b0463bf1a723d74
# Parent 4e69b24a23011918b25ad7a1ed3d38f6f22c6704
Return a fixnum as documented with marker arg, #'max, #'min
2013-12-15 Aidan Kehoe <kehoea(a)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.
diff -r 4e69b24a2301 -r 3bfcdeb65578 src/ChangeLog
--- 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(a)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(a)xemacs.org>
* font-mgr.c: Fix a bunch of comments and reformat some docstrings.
diff -r 4e69b24a2301 -r 3bfcdeb65578 src/data.c
--- 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
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches