mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-05 14:11:01 +00:00
Replace COSMO define with _COSMO_SOURCE
This change might cause ABI breakages for /opt/cosmos. It's needed to help us better conform to header declaration practices.
This commit is contained in:
parent
a033b65a33
commit
c776a32f75
238 changed files with 858 additions and 1069 deletions
23
third_party/dlmalloc/dlmalloc.c
vendored
23
third_party/dlmalloc/dlmalloc.c
vendored
|
@ -1297,29 +1297,6 @@ void* dlmemalign(size_t alignment, size_t bytes) {
|
|||
return internal_memalign(gm, alignment, bytes);
|
||||
}
|
||||
|
||||
int dlposix_memalign(void** pp, size_t alignment, size_t bytes) {
|
||||
void* mem = 0;
|
||||
if (alignment == MALLOC_ALIGNMENT)
|
||||
mem = dlmalloc(bytes);
|
||||
else {
|
||||
size_t d = alignment / sizeof(void*);
|
||||
size_t r = alignment % sizeof(void*);
|
||||
if (r != 0 || d == 0 || (d & (d-SIZE_T_ONE)) != 0)
|
||||
return EINVAL;
|
||||
else if (bytes <= MAX_REQUEST - alignment) {
|
||||
if (alignment < MIN_CHUNK_SIZE)
|
||||
alignment = MIN_CHUNK_SIZE;
|
||||
mem = internal_memalign(gm, alignment, bytes);
|
||||
}
|
||||
}
|
||||
if (!mem) {
|
||||
return ENOMEM;
|
||||
} else {
|
||||
*pp = mem;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_LOCKS
|
||||
void dlmalloc_atfork(void) {
|
||||
bzero(&gm->mutex, sizeof(gm->mutex));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue