1 #ifndef YACASL2_CMEM_H_INCLUDED
2 #define YACASL2_CMEM_H_INCLUDED
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <assert.h>
8 #include <stdbool.h>
9
10
11
12
13 #ifndef ARRAYSIZE
14 #define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0]))
15 #endif
16
17
18
19
20 #ifndef FREE
21 #define FREE(ptr) {free(ptr); ptr = NULL;}
22 #endif
23
24
25
26
27
28
29
30
31
32
33
34 void *malloc_chk(size_t size, const char *tag);
35
36
37
38
39
40
41
42
43
44
45
46
47 void *calloc_chk(size_t nmemb, size_t size, const char *tag);
48
49
50
51
52
53
54
55
56
57 char *strdup_chk(const char *s, const char *tag);
58
59
60
61
62
63
64
65
66
67
68 char *strndup_chk(const char *s, size_t len, const char *tag);
69
70
71
72
73
74
75
76
77 void strip_end(char *s);
78
79
80
81
82
83
84
85
86 void strip_casl2_comment(char *s);
87
88
89
90
91
92
93
94
95 char *strrev(const char *s);
96
97 #endif