Blame support/xposix_memalign.c
|
Packit Service |
261d5e |
/* Error-checking wrapper for posix_memalign.
|
|
Packit Service |
261d5e |
Copyright (C) 2019 Free Software Foundation, Inc.
|
|
Packit Service |
261d5e |
This file is part of the GNU C Library.
|
|
Packit Service |
261d5e |
|
|
Packit Service |
261d5e |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
261d5e |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
261d5e |
License as published by the Free Software Foundation; either
|
|
Packit Service |
261d5e |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
261d5e |
|
|
Packit Service |
261d5e |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
261d5e |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
261d5e |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
261d5e |
Lesser General Public License for more details.
|
|
Packit Service |
261d5e |
|
|
Packit Service |
261d5e |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
261d5e |
License along with the GNU C Library; if not, see
|
|
Packit Service |
261d5e |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
261d5e |
|
|
Packit Service |
261d5e |
#include <support/support.h>
|
|
Packit Service |
261d5e |
#include <stdlib.h>
|
|
Packit Service |
261d5e |
#include <errno.h>
|
|
Packit Service |
261d5e |
|
|
Packit Service |
261d5e |
void *
|
|
Packit Service |
261d5e |
xposix_memalign (size_t alignment, size_t n)
|
|
Packit Service |
261d5e |
{
|
|
Packit Service |
261d5e |
void *p = NULL;
|
|
Packit Service |
261d5e |
|
|
Packit Service |
261d5e |
int ret = posix_memalign (&p, alignment, n);
|
|
Packit Service |
261d5e |
if (ret)
|
|
Packit Service |
261d5e |
{
|
|
Packit Service |
261d5e |
errno = ret;
|
|
Packit Service |
261d5e |
oom_error ("posix_memalign", n);
|
|
Packit Service |
261d5e |
}
|
|
Packit Service |
261d5e |
return p;
|
|
Packit Service |
261d5e |
}
|