[1054] | 1 | /*
|
---|
| 2 | * $Id$
|
---|
| 3 | *
|
---|
| 4 | * Header file of mr_mem: a set of function manipulating memory
|
---|
| 5 | * Provided under the GPL v2
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef MR_MEM_H
|
---|
| 9 | #define MR_MEM_H
|
---|
| 10 |
|
---|
[1061] | 11 | #ifndef _GNU_SOURCE
|
---|
| 12 | #define _GNU_SOURCE
|
---|
| 13 | #endif
|
---|
| 14 | #include <stdarg.h>
|
---|
[1096] | 15 | #include <stdio.h>
|
---|
[3708] | 16 | #include "mr_std.h"
|
---|
[1061] | 17 |
|
---|
[1054] | 18 | /* functions (public methods) */
|
---|
| 19 |
|
---|
[1104] | 20 | #define mr_free(x) mr_free_int((void **)&x,__LINE__,__FILE__)
|
---|
[3185] | 21 | #define mr_asprintf(x,y,args...) mr_asprintf_int((char **)&x,__LINE__,__FILE__,y,## args)
|
---|
| 22 | #define mr_getline(x,y) mr_getline_int((char **)&x,y,__LINE__,__FILE__)
|
---|
[1104] | 23 | #define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__)
|
---|
[1152] | 24 | #define mr_setenv(x,y) mr_setenv_int(x,y,__LINE__,__FILE__)
|
---|
[1196] | 25 | #define mr_strcat(x,y,args...) mr_strcat_int((char **)&x, __LINE__,__FILE__, y,## args);
|
---|
[1054] | 26 |
|
---|
[1104] | 27 | /* Internal function bringing debuging info
|
---|
| 28 | * called indirectly through macros */
|
---|
[3845] | 29 | MR_EXTERN void mr_free_int(void **allocated, int line, const char *file);
|
---|
| 30 | MR_EXTERN void mr_asprintf_int(char **alloc, int line, const char *file, const char *fmt, ...);
|
---|
| 31 | MR_EXTERN void mr_getline_int(char **lineptr, FILE *stream, int line, const char *file);
|
---|
| 32 | MR_EXTERN void *mr_malloc_int(size_t size, int line, const char *file);
|
---|
| 33 | MR_EXTERN void mr_setenv_int(const char *name, const char *value, int line, const char *file);
|
---|
| 34 | MR_EXTERN void mr_strcat_int(char **in, int line, const char *file, const char *fmt, ...);
|
---|
[1104] | 35 |
|
---|
[1054] | 36 | #endif /* MR_MEM_H */
|
---|