File: malloc_wrap.h

package info (click to toggle)
gatk-bwamem 1.0.4%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,256 kB
  • sloc: ansic: 12,321; java: 860; makefile: 124; sh: 36
file content (47 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download | duplicates (9)
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
41
42
43
44
45
46
47
#ifndef MALLOC_WRAP_H
#define MALLOC_WRAP_H

#include <stdlib.h>  /* Avoid breaking the usual definitions */
#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

	void *wrap_calloc(size_t nmemb, size_t size,
					  const char *file, unsigned int line, const char *func);
	void *wrap_malloc(size_t size,
					  const char *file, unsigned int line, const char *func);
	void *wrap_realloc(void *ptr, size_t size,
					   const char *file, unsigned int line, const char *func);
	char *wrap_strdup(const char *s,
					  const char *file, unsigned int line, const char *func);

#ifdef __cplusplus
}
#endif

#ifdef USE_MALLOC_WRAPPERS
#  ifdef calloc
#    undef calloc
#  endif
#  define calloc(n, s)  wrap_calloc( (n), (s), __FILE__, __LINE__, __func__)

#  ifdef malloc
#    undef malloc
#  endif
#  define malloc(s)     wrap_malloc( (s),      __FILE__, __LINE__, __func__)

#  ifdef realloc
#    undef realloc
#  endif
#  define realloc(p, s) wrap_realloc((p), (s), __FILE__, __LINE__, __func__)

#  ifdef strdup
#    undef strdup
#  endif
#  define strdup(s)     wrap_strdup( (s),      __FILE__, __LINE__, __func__)

#endif /* USE_MALLOC_WRAPPERS */

#endif /* MALLOC_WRAP_H */