hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame support/xposix_memalign.c

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