src/allocator.c

changeset 1104
b03aee2cbb7f
parent 1065
6eb7b54975ee
equal deleted inserted replaced
1103:7c1e322b9165 1104:b03aee2cbb7f
28 28
29 #include "cx/allocator.h" 29 #include "cx/allocator.h"
30 30
31 #include <errno.h> 31 #include <errno.h>
32 32
33 __attribute__((__malloc__, __alloc_size__(2)))
34 static void *cx_malloc_stdlib( 33 static void *cx_malloc_stdlib(
35 cx_attr_unused void *d, 34 cx_attr_unused void *d,
36 size_t n 35 size_t n
37 ) { 36 ) {
38 return malloc(n); 37 return malloc(n);
39 } 38 }
40 39
41 __attribute__((__warn_unused_result__, __alloc_size__(3)))
42 static void *cx_realloc_stdlib( 40 static void *cx_realloc_stdlib(
43 cx_attr_unused void *d, 41 cx_attr_unused void *d,
44 void *mem, 42 void *mem,
45 size_t n 43 size_t n
46 ) { 44 ) {
47 return realloc(mem, n); 45 return realloc(mem, n);
48 } 46 }
49 47
50 __attribute__((__malloc__, __alloc_size__(2, 3)))
51 static void *cx_calloc_stdlib( 48 static void *cx_calloc_stdlib(
52 cx_attr_unused void *d, 49 cx_attr_unused void *d,
53 size_t nelem, 50 size_t nelem,
54 size_t n 51 size_t n
55 ) { 52 ) {
56 return calloc(nelem, n); 53 return calloc(nelem, n);
57 } 54 }
58 55
59 __attribute__((__nonnull__))
60 static void cx_free_stdlib( 56 static void cx_free_stdlib(
61 cx_attr_unused void *d, 57 cx_attr_unused void *d,
62 void *mem 58 void *mem
63 ) { 59 ) {
64 free(mem); 60 free(mem);

mercurial