changeset 4115:6595286b4bed

[xemacs-hg @ 2007-08-14 18:58:13 by crestani] 2006-12-29 Nix <nix@esperi.org.uk> * gc.c (recompute_need_to_garbage_collect): Avoid numeric overflow in percentage calculation.
author crestani
date Tue, 14 Aug 2007 18:58:16 +0000
parents 3a33c28ce351
children 9a42c5e5eb4e
files src/ChangeLog src/gc.c
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Aug 13 21:51:24 2007 +0000
+++ b/src/ChangeLog	Tue Aug 14 18:58:16 2007 +0000
@@ -1,3 +1,8 @@
+2006-12-29  Nix  <nix@esperi.org.uk>
+
+	* gc.c (recompute_need_to_garbage_collect): Avoid numeric
+	overflow in percentage calculation.
+
 2007-08-04  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* sunpro.c (Fut_log_text): Fix mismatched parentheses, reorganize.
--- a/src/gc.c	Mon Aug 13 21:51:24 2007 +0000
+++ b/src/gc.c	Tue Aug 14 18:58:16 2007 +0000
@@ -314,12 +314,12 @@
       (consing_since_gc > gc_cons_threshold
        &&
 #if 0 /* #### implement this better */
-       (100 * consing_since_gc) / total_data_usage () >=
-       gc_cons_percentage
+       ((double)consing_since_gc) / total_data_usage()) >=
+      ((double)gc_cons_percentage / 100)
 #else
        (!total_gc_usage_set ||
-	(100 * consing_since_gc) / total_gc_usage >=
-	gc_cons_percentage)
+	((double)consing_since_gc / total_gc_usage) >=
+	((double)gc_cons_percentage / 100))
 #endif
        );
   recompute_funcall_allocation_flag ();