=bmesh= merge from trunk at r36529
[blender.git] / intern / guardedalloc / intern / mallocn.c
index 60e7f0078d7c681bed5ff72e6f769830e35d3172..0ce6a92359d6ad89aee59b12da7f5bcb5dc5504e 100644 (file)
@@ -331,16 +331,16 @@ void *MEM_mapallocN(size_t len, const char *str)
        {
 #include <fcntl.h>
 
-         int fd;
-         fd = open("/dev/zero", O_RDWR);
+               int fd;
+               fd = open("/dev/zero", O_RDWR);
 
-         memh= mmap(0, len+sizeof(MemHead)+sizeof(MemTail),
-                    PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-         close(fd);
+               memh= mmap(0, len+sizeof(MemHead)+sizeof(MemTail),
+                               PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+               close(fd);
        }
 #else
        memh= mmap(NULL, len+sizeof(MemHead)+sizeof(MemTail),
-                  PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
+                       PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
 #endif
 
        if(memh!=(MemHead *)-1) {
@@ -679,26 +679,26 @@ static void remlink(volatile localListBase *listbase, void *vlink)
 
 static void rem_memblock(MemHead *memh)
 {
-    remlink(membase,&memh->next);
-    if (memh->prev) {
-        if (memh->next) 
+       remlink(membase,&memh->next);
+       if (memh->prev) {
+               if (memh->next)
                        MEMNEXT(memh->prev)->nextname = MEMNEXT(memh->next)->name;
-        else 
+               else
                        MEMNEXT(memh->prev)->nextname = NULL;
-    }
-
-    totblock--;
-    mem_in_use -= memh->len;
-   
-    if(memh->mmap) {
-        mmap_in_use -= memh->len;
-        if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
-            printf("Couldn't unmap memory %s\n", memh->name);
-    }
-    else {
+       }
+
+       totblock--;
+       mem_in_use -= memh->len;
+
+       if(memh->mmap) {
+               mmap_in_use -= memh->len;
+               if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
+                       printf("Couldn't unmap memory %s\n", memh->name);
+       }
+       else {
                if(malloc_debug_memset && memh->len)
                        memset(memh+1, 255, memh->len);
-        free(memh);
+               free(memh);
        }
 }
 
@@ -773,7 +773,7 @@ static const char *check_memlist(MemHead *memh)
                                forwok->nextname = backok->name;
                        } else{
                                forwok->next = NULL;
-                               membase->last = (struct localLink *) &forwok->next; 
+                               membase->last = (struct localLink *) &forwok->next;
 /*                             membase->last = (struct Link *) &forwok->next; */
                        }
                } else{