[Bf-committers] mallocn.c

Johnny Matthews johnny.matthews at gmail.com
Fri Feb 17 15:43:12 CET 2006


I was getting an unresolved external for munmap on win32, I made this 
change and it seems to work. I don't know this code, so I did not want 
to commit it

in mallocn.c
------------------old function-----------------

static void rem_memblock(MemHead *memh)
{
    remlink(membase,&memh->next);
    if (memh->prev){
        if (memh->next) MEMNEXT(memh->prev)->nextname = 
MEMNEXT(memh->next)->name;
        else MEMNEXT(memh->prev)->nextname = 0;
    }

    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   
        free(memh);
}

-------------------new function -----------------------------
static void rem_memblock(MemHead *memh)
{
    remlink(membase,&memh->next);
    if (memh->prev){
        if (memh->next) MEMNEXT(memh->prev)->nextname = 
MEMNEXT(memh->next)->name;
        else MEMNEXT(memh->prev)->nextname = 0;
    }

    totblock--;
    mem_in_use -= memh->len;
   
#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
    free(memh);
#else   
   
    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   
        free(memh);
#endif
}




is this correct?

-- 
Johnny Matthews
johnny.matthews at gmail.com



More information about the Bf-committers mailing list