From dafc6fe52dceb4ab063b177d74c60bebd47c8e54 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 14 Nov 2012 09:41:59 +0100 Subject: [PATCH] Size can be negative. Use ssize_t instead of size_t. Error caught by Clang: In file included from /home/giersch/lsrc/simgrid/simgrid-git/src/xbt/mmalloc/mm.c:21: src/xbt/mmalloc/mmorecore.c:74:19: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] } else if (size < 0) { --- src/xbt/mmalloc/mmorecore.c | 2 +- src/xbt/mmalloc/mmprivate.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xbt/mmalloc/mmorecore.c b/src/xbt/mmalloc/mmorecore.c index a2f6cfedb9..e1175a7c3d 100644 --- a/src/xbt/mmalloc/mmorecore.c +++ b/src/xbt/mmalloc/mmorecore.c @@ -53,7 +53,7 @@ static size_t pagesize; It never returns NULL. Instead, it dies verbosely on errors. */ -void *mmorecore(struct mdesc *mdp, size_t size) +void *mmorecore(struct mdesc *mdp, ssize_t size) { ssize_t test = 0; void *result; // please keep it uninitialized to track issues diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 8cfc0adb7e..26feb7d962 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -272,7 +272,7 @@ XBT_PUBLIC( void *)__mmalloc_remap_core(xbt_mheap_t mdp); /* Get core for the memory region specified by MDP, using SIZE as the amount to either add to or subtract from the existing region. Works like sbrk(), but using mmap(). */ -XBT_PUBLIC( void *)mmorecore(struct mdesc *mdp, size_t size); +XBT_PUBLIC( void *)mmorecore(struct mdesc *mdp, ssize_t size); /* Thread-safety (if the sem is already created) * -- 2.20.1