]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.c
Rename qboolean to qbool
[xonotic/darkplaces.git] / zone.c
diff --git a/zone.c b/zone.c
index 5a0c8987a0c3e2f184999aa0ed09e2ff46dc72bc..1298c1773bd015601c1213052a4de76be1ad21cb 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #define MEMHEADER_SENTINEL_FOR_ADDRESS(p) ((sentinel_seed ^ (unsigned int) (uintptr_t) (p)) + sentinel_seed)
 unsigned int sentinel_seed;
 
-qboolean mem_bigendian = false;
+qbool mem_bigendian = false;
 void *mem_mutex = NULL;
 
 // divVerent: enables file backed malloc using mmap to conserve swap space (instead of malloc)
@@ -107,6 +107,9 @@ void Mem_PrintList(size_t minallocationsize);
 #if FILE_BACKED_MALLOC
 #include <stdlib.h>
 #include <sys/mman.h>
+#ifndef MAP_NORESERVE
+#define MAP_NORESERVE 0
+#endif
 typedef struct mmap_data_s
 {
        size_t len;
@@ -127,7 +130,7 @@ static void *mmap_malloc(size_t size)
        data = (unsigned char *) mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERVE, fd, 0);
        close(fd);
        unlink(vabuf);
-       if(!data)
+       if(!data || data == (void *)-1)
                return NULL;
        data->len = size;
        return (void *) (data + 1);
@@ -657,7 +660,7 @@ void _Mem_CheckSentinelsGlobal(const char *filename, int fileline)
 #endif
 }
 
-qboolean Mem_IsAllocated(mempool_t *pool, void *data)
+qbool Mem_IsAllocated(mempool_t *pool, void *data)
 {
        memheader_t *header;
        memheader_t *target;
@@ -758,9 +761,9 @@ void Mem_ExpandableArray_FreeRecord(memexpandablearray_t *l, void *record) // co
                {
                        j = (p - l->arrays[i].data) / l->recordsize;
                        if (p != l->arrays[i].data + j * l->recordsize)
-                               Sys_Error("Mem_ExpandableArray_FreeRecord: no such record %p\n", p);
+                               Sys_Error("Mem_ExpandableArray_FreeRecord: no such record %p\n", (void *)p);
                        if (!l->arrays[i].allocflags[j])
-                               Sys_Error("Mem_ExpandableArray_FreeRecord: record %p is already free!\n", p);
+                               Sys_Error("Mem_ExpandableArray_FreeRecord: record %p is already free!\n", (void *)p);
                        l->arrays[i].allocflags[j] = false;
                        l->arrays[i].numflaggedrecords--;
                        return;