[glib: 1/2] gslice: Use a convenience macro



commit 45a3598aa2c477b27284d34af46ec3d21dd499ac
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Apr 3 12:46:20 2019 -0400

    gslice: Use a convenience macro
    
    In magazine_cache_trim(), use the recent G_APPROX_VALUE macro to decide
    when to trim the magazine chain.
    
    See <URL:https://gitlab.gnome.org/GNOME/glib/commit/fad04d2e18832106ecb4b9f04ae3bfdbcacc9053#note_471824>.

 glib/gslice.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/glib/gslice.c b/glib/gslice.c
index b192ba7f1..0e1726138 100644
--- a/glib/gslice.c
+++ b/glib/gslice.c
@@ -640,10 +640,8 @@ magazine_cache_trim (Allocator *allocator,
   /* trim magazine cache from tail */
   ChunkLink *current = magazine_chain_prev (allocator->magazines[ix]);
   ChunkLink *trash = NULL;
-  while ((stamp >= magazine_chain_uint_stamp (current) &&
-          stamp - magazine_chain_uint_stamp (current) >= allocator->config.working_set_msecs) ||
-         (stamp <= magazine_chain_uint_stamp (current) &&
-          magazine_chain_uint_stamp (current) - stamp >= allocator->config.working_set_msecs))
+  while (!G_APPROX_VALUE(stamp, magazine_chain_uint_stamp (current),
+                         allocator->config.working_set_msecs))
     {
       /* unlink */
       ChunkLink *prev = magazine_chain_prev (current);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]