Blame support/xposix_memalign.c

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