From: Arnaud Giersch Date: Wed, 14 Nov 2012 08:41:59 +0000 (+0100) Subject: Size can be negative. Use ssize_t instead of size_t. X-Git-Tag: v3_9_rc1~91^2~108 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dafc6fe52dceb4ab063b177d74c60bebd47c8e54?hp=0d2c98345e65093248d2ae20dc713065c9c0f53c 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) { --- 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) *