aboutsummaryrefslogtreecommitdiffstats
path: root/lib/allocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/allocator.h')
-rw-r--r--lib/allocator.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/allocator.h b/lib/allocator.h
index 4ac863b224c..953117da83f 100644
--- a/lib/allocator.h
+++ b/lib/allocator.h
@@ -18,6 +18,7 @@
18/* Written by Paul Eggert. */ 18/* Written by Paul Eggert. */
19 19
20#ifndef _GL_ALLOCATOR_H 20#ifndef _GL_ALLOCATOR_H
21#define _GL_ALLOCATOR_H
21 22
22#include <stddef.h> 23#include <stddef.h>
23 24
@@ -30,16 +31,16 @@ struct allocator
30 attributes do not work with pointers to functions. See 31 attributes do not work with pointers to functions. See
31 <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00007.html>. */ 32 <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00007.html>. */
32 33
33 /* Call MALLOC to allocate memory, like 'malloc'. On failure MALLOC 34 /* Call ALLOCATE to allocate memory, like 'malloc'. On failure ALLOCATE
34 should return NULL, though not necessarily set errno. When given 35 should return NULL, though not necessarily set errno. When given
35 a zero size it may return NULL even if successful. */ 36 a zero size it may return NULL even if successful. */
36 void *(*malloc) (size_t); 37 void *(*allocate) (size_t);
37 38
38 /* If nonnull, call REALLOC to reallocate memory, like 'realloc'. 39 /* If nonnull, call REALLOCATE to reallocate memory, like 'realloc'.
39 On failure REALLOC should return NULL, though not necessarily set 40 On failure REALLOCATE should return NULL, though not necessarily set
40 errno. When given a zero size it may return NULL even if 41 errno. When given a zero size it may return NULL even if
41 successful. */ 42 successful. */
42 void *(*realloc) (void *, size_t); 43 void *(*reallocate) (void *, size_t);
43 44
44 /* Call FREE to free memory, like 'free'. */ 45 /* Call FREE to free memory, like 'free'. */
45 void (*free) (void *); 46 void (*free) (void *);
@@ -50,4 +51,7 @@ struct allocator
50 void (*die) (void); 51 void (*die) (void);
51}; 52};
52 53
53#endif 54/* An allocator using the stdlib functions and a null DIE function. */
55extern struct allocator const stdlib_allocator;
56
57#endif /* _GL_ALLOCATOR_H */