version 1.16, 2009/06/22 05:39:28 |
version 1.17, 2013/05/17 00:13:13 |
|
|
|
|
#include <errno.h> |
#include <errno.h> |
#include <stdarg.h> |
#include <stdarg.h> |
|
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
|
|
next = RB_NEXT(mmtree, head, mms); |
next = RB_NEXT(mmtree, head, mms); |
RB_REMOVE(mmtree, head, mms); |
RB_REMOVE(mmtree, head, mms); |
if (mmalloc == NULL) |
if (mmalloc == NULL) |
xfree(mms); |
free(mms); |
else |
else |
mm_free(mmalloc, mms); |
mm_free(mmalloc, mms); |
} |
} |
|
|
fatal("munmap(%p, %lu): %s", mm->address, (u_long)mm->size, |
fatal("munmap(%p, %lu): %s", mm->address, (u_long)mm->size, |
strerror(errno)); |
strerror(errno)); |
if (mm->mmalloc == NULL) |
if (mm->mmalloc == NULL) |
xfree(mm); |
free(mm); |
else |
else |
mm_free(mm->mmalloc, mm); |
mm_free(mm->mmalloc, mm); |
} |
} |
|
|
if (mms->size == 0) { |
if (mms->size == 0) { |
RB_REMOVE(mmtree, &mm->rb_free, mms); |
RB_REMOVE(mmtree, &mm->rb_free, mms); |
if (mm->mmalloc == NULL) |
if (mm->mmalloc == NULL) |
xfree(mms); |
free(mms); |
else |
else |
mm_free(mm->mmalloc, mms); |
mm_free(mm->mmalloc, mms); |
} |
} |
|
|
prev->size += mms->size; |
prev->size += mms->size; |
RB_REMOVE(mmtree, &mm->rb_free, mms); |
RB_REMOVE(mmtree, &mm->rb_free, mms); |
if (mm->mmalloc == NULL) |
if (mm->mmalloc == NULL) |
xfree(mms); |
free(mms); |
else |
else |
mm_free(mm->mmalloc, mms); |
mm_free(mm->mmalloc, mms); |
} else |
} else |
|
|
RB_REMOVE(mmtree, &mm->rb_free, mms); |
RB_REMOVE(mmtree, &mm->rb_free, mms); |
|
|
if (mm->mmalloc == NULL) |
if (mm->mmalloc == NULL) |
xfree(mms); |
free(mms); |
else |
else |
mm_free(mm->mmalloc, mms); |
mm_free(mm->mmalloc, mms); |
} |
} |