mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Clean up some code
This commit is contained in:
parent
531bfbd61f
commit
ed161b240e
17 changed files with 107 additions and 182 deletions
|
@ -35,9 +35,10 @@
|
|||
* @param bytes is number of bytes to allocate
|
||||
* @return return 0 or EINVAL or ENOMEM w/o setting errno
|
||||
* @see memalign()
|
||||
* @returnserrno
|
||||
* @threadsafe
|
||||
*/
|
||||
int posix_memalign(void **pp, size_t alignment, size_t bytes) {
|
||||
errno_t posix_memalign(void **pp, size_t alignment, size_t bytes) {
|
||||
int e;
|
||||
void *m;
|
||||
size_t q, r;
|
||||
|
@ -46,11 +47,11 @@ int posix_memalign(void **pp, size_t alignment, size_t bytes) {
|
|||
if (!r && q && IS2POW(q)) {
|
||||
e = errno;
|
||||
m = memalign(alignment, bytes);
|
||||
errno = e;
|
||||
if (m) {
|
||||
*pp = m;
|
||||
return 0;
|
||||
} else {
|
||||
errno = e;
|
||||
return ENOMEM;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue