-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml_parser_mem.h
More file actions
40 lines (30 loc) · 1003 Bytes
/
Copy pathhtml_parser_mem.h
File metadata and controls
40 lines (30 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef __MEM_INCLUDED__
#define __MEM_INCLUDED__
#ifdef __cplusplus
extern "C" {
#endif
#include "html_parser_except.h"
/* exported exceptions */
extern const Except_T Mem_Failed;
/* exported functions */
extern void *Mem_alloc(long nbytes, const char *file, int line);
extern void *Mem_calloc(long count, long nbytes, const char *file,
int line);
extern void Mem_free(void *ptr, const char *file, int line);
extern void *Mem_resize(void *ptr, long nbytes, const char *file,
int line);
/* exported macros */
#define ALLOC(nbytes) \
Mem_alloc((nbytes), __FILE__, __LINE__)
#define CALLOC(count, nbytes) \
Mem_calloc((count), (nbytes), __FILE__, __LINE__)
#define NEW(p) ((p) = ALLOC((long) sizeof *(p)))
#define NEW0(p) ((p) = CALLOC(1, (long) sizeof *(p)))
#define FREE(ptr) ((void)(Mem_free((ptr), __FILE__, __LINE__), \
(ptr) = 0))
#define RESIZE(ptr, nbytes) ((ptr) = Mem_resize((ptr), (nbytes), \
__FILE__, __LINE__))
#ifdef __cplusplus
}
#endif
#endif /* __MEM_INCLUDED__ */