[glib: 24/25] Fixing signedness warning in glib/gslice.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 24/25] Fixing signedness warning in glib/gslice.c
- Date: Tue, 19 Mar 2019 11:04:51 +0000 (UTC)
commit fad04d2e18832106ecb4b9f04ae3bfdbcacc9053
Author: Emmanuel Fleury <emmanuel fleury u-bordeaux fr>
Date: Sat Feb 23 09:56:57 2019 +0100
Fixing signedness warning in glib/gslice.c
In file included from glib/glibconfig.h:9,
from glib/gslice.c:20:
glib/gslice.c: In function ‘magazine_cache_trim’:
glib/gmacros.h:354:25: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
#define ABS(a) (((a) < 0) ? -(a) : (a))
^
glib/gslice.c:643:10: note: in expansion of macro ‘ABS’
while (ABS (stamp - magazine_chain_uint_stamp (current)) >= allocator->config.working_set_msecs)
^~~
glib/gslice.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/glib/gslice.c b/glib/gslice.c
index 86e76cec0..b192ba7f1 100644
--- a/glib/gslice.c
+++ b/glib/gslice.c
@@ -640,7 +640,10 @@ magazine_cache_trim (Allocator *allocator,
/* trim magazine cache from tail */
ChunkLink *current = magazine_chain_prev (allocator->magazines[ix]);
ChunkLink *trash = NULL;
- while (ABS (stamp - magazine_chain_uint_stamp (current)) >= allocator->config.working_set_msecs)
+ 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))
{
/* unlink */
ChunkLink *prev = magazine_chain_prev (current);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]