blob: d1d06fbb55fdaecb70b2ea1d61899dab83b79f6a (
plain)
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
|
/*
* tkAlloc.h --
*
* This module provides an interface to memory allocation functions, this
* is: malloc(), realloc(), free(). This has the following advantages:
*
* 1. The whole features of the very valuable tool Valgrind can be used,
* this requires to bypass the Tcl allocation functions.
*
* 2. Backport to version 8.5, this is important because the Mac version
* of wish8.6 has event loop issues.
*
* Copyright (c) 2015-2017 Gregor Cramer
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TK_ALLOC
#define _TK_ALLOC
#include "tcl.h"
#if TK_VALGRIND
# include <stdlib.h>
/* enables compiler check that these functions will not be used */
# undef ckalloc
# undef ckrealloc
# undef ckfree
#else /* if !TK_VALGRIND */
/* the main reason for these definitions is portability to 8.5 */
# define malloc(size) ((void *) (ckalloc(size)))
# define realloc(ptr, size) ((void *) (ckrealloc((char *) (ptr), size)))
# define free(ptr) ckfree((char *) (ptr))
#endif /* TK_VALGRIND */
#endif /* _TK_ALLOC */
/* vi:set ts=8 sw=4: */
|