vaseboot/VasEBoot-core/lib/posix_wrap/stdlib.h

76 lines
1.6 KiB
C

/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2009, 2010 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VAS_EBOOT_POSIX_STDLIB_H
#define VAS_EBOOT_POSIX_STDLIB_H 1
#include <VasEBoot/mm.h>
#include <VasEBoot/misc.h>
#include <VasEBoot/safemath.h>
static inline void
free (void *ptr)
{
VasEBoot_free (ptr);
}
static inline void *
malloc (VasEBoot_size_t size)
{
return VasEBoot_malloc (size);
}
static inline void *
calloc (VasEBoot_size_t size, VasEBoot_size_t nelem)
{
VasEBoot_size_t sz;
if (VasEBoot_mul (size, nelem, &sz))
return NULL;
return VasEBoot_zalloc (sz);
}
static inline void *
realloc (void *ptr, VasEBoot_size_t size)
{
return VasEBoot_realloc (ptr, size);
}
static inline int
abs (int c)
{
return (c >= 0) ? c : -c;
}
static inline void __attribute__ ((noreturn))
abort (void)
{
VasEBoot_abort ();
}
#define strtol VasEBoot_strtol
/* for libgcrypt */
#define HAVE_STRTOUL
#define strtoul VasEBoot_strtoul
#define strtoull VasEBoot_strtoull
#endif