Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Size can be negative. Use ssize_t instead of size_t.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 14 Nov 2012 08:41:59 +0000 (09:41 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 14 Nov 2012 08:44:40 +0000 (09:44 +0100)
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
src/xbt/mmalloc/mmprivate.h

index a2f6cfe..e1175a7 100644 (file)
@@ -53,7 +53,7 @@ static size_t pagesize;
 
     It never returns NULL. Instead, it dies verbosely on errors. */
 
 
     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
 {
   ssize_t test = 0;
   void *result; // please keep it uninitialized to track issues
index 8cfc0ad..26feb7d 100644 (file)
@@ -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(). */
 /*  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)
  *
 
 /* Thread-safety (if the sem is already created)
  *