/* Memory allocation with expensive empty allocations.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2008, 2010-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003,
based on prior work by Jim Meyering.
- This program is free software; you can redistribute it and/or modify
+ This program 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 2, or (at your option)
- any later version.
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _EEALLOC_H
#define _EEALLOC_H
#include <stdlib.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef EEALLOC_INLINE
+# define EEALLOC_INLINE _GL_INLINE
+#endif
+
#if MALLOC_0_IS_NONNULL
# define eemalloc malloc
#else
-static inline void *
+# if __GNUC__ >= 3
+EEALLOC_INLINE void *eemalloc (size_t n)
+ __attribute__ ((__malloc__))
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+ __attribute__ ((__alloc_size__ (1)))
+# endif
+ ;
+# endif
+EEALLOC_INLINE void *
eemalloc (size_t n)
{
/* If n is zero, allocate a 1-byte block. */
#if REALLOC_0_IS_NONNULL
# define eerealloc realloc
#else
-static inline void *
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+EEALLOC_INLINE void *eerealloc (void *p, size_t n)
+ __attribute__ ((__alloc_size__ (2)));
+# endif
+EEALLOC_INLINE void *
eerealloc (void *p, size_t n)
{
/* If n is zero, allocate or keep a 1-byte block. */
eenrealloc (void *p, size_t n, size_t s) - like eerealloc (p, n * s)
If this would be useful in your application. please speak up. */
+_GL_INLINE_HEADER_END
+
#endif /* _EEALLOC_H */