From: Paul Eggert Date: Tue, 14 Jun 2011 23:18:53 +0000 (-0700) Subject: * fns.c (Fload_average): Don't assume 100 * load average fits in int. X-Git-Tag: emacs-pretest-24.0.90~104^2~548^2~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=566684ead5a577f6b2506f242494f2fa57eb5a49;p=emacs.git * fns.c (Fload_average): Don't assume 100 * load average fits in int. --- 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); }