From 566684ead5a577f6b2506f242494f2fa57eb5a49 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 14 Jun 2011 16:18:53 -0700 Subject: [PATCH] * fns.c (Fload_average): Don't assume 100 * load average fits in int. --- src/ChangeLog | 2 ++ src/fns.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5cb9384f6fb..35dab796be7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-06-14 Paul Eggert + * fns.c (Fload_average): Don't assume 100 * load average fits in int. + * fns.c: Don't overflow int when computing a list length. * fns.c (QUIT_COUNT_HEURISTIC): New constant. (Flength, Fsafe_length): Use EMACS_INT, not int, to avoid unwanted diff --git a/src/fns.c b/src/fns.c index 69b95cba09c..a19c886e3e1 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2542,8 +2542,8 @@ advisable. */) while (loads-- > 0) { - Lisp_Object load = (NILP (use_floats) ? - make_number ((int) (100.0 * load_ave[loads])) + Lisp_Object load = (NILP (use_floats) + ? make_number (100.0 * load_ave[loads]) : make_float (load_ave[loads])); ret = Fcons (load, ret); } -- 2.39.2