source: branches/stable/mondo/src/include/mr_mem.h @ 1104

Last change on this file since 1104 was 1104, checked in by bruno, 13 years ago

Improvement of the low level library (Usage of LINE and FILE and simplified interfaces using macros)

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
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
11#ifndef _GNU_SOURCE
12#define _GNU_SOURCE
13#endif
14#include <stdarg.h>
15#include <stdio.h>
16
17/* functions (public methods) */
18
19#define mr_free(x) mr_free_int((void **)&x,__LINE__,__FILE__)
20#define mr_allocstr(x,y) mr_allocstr_int(x, y,__LINE__,__FILE__)
21#define mr_asprintf(x,y,args...) mr_asprintf_int(x,__LINE__,__FILE__, y, ## args)
22#define mr_getline(x,y,z) mr_getline_int(x, y,z,__LINE__,__FILE__)
23#define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__)
24
25/* Internal function bringing debuging info
26 * called indirectly through macros */
27extern inline void mr_free_int(void **allocated, int line, char *file);
28extern inline void mr_allocstr_int(char *alloc, const char *orig, int line, char *file);
29extern inline void mr_asprintf_int(char **alloc, int line, char *file, const char *fmt, ...);
30extern inline void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, char *file);
31extern inline void *mr_malloc_int(size_t size, int line, char *file);
32
33#endif                          /* MR_MEM_H */
Note: See TracBrowser for help on using the repository browser.