Fork me on GitHub

source: git/external/tcl/tclCkalloc.c@ 952bbbc

Last change on this file since 952bbbc was adeddd8, checked in by Pavel Demin <pavel-demin@…>, 5 years ago

remove debug code from Tcl

  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[d7d2da3]1/*
2 * tclCkalloc.c --
3 *
4 * Interface to malloc and free that provides support for debugging problems
5 * involving overwritten, double freeing memory and loss of memory.
6 *
7 * Copyright (c) 1991-1994 The Regents of the University of California.
8 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
9 *
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 *
13 * This code contributed by Karl Lehenbauer and Mark Diekhans
14 *
15 * RCS: @(#) $Id: tclCkalloc.c,v 1.1 2008-06-04 13:58:04 demin Exp $
16 */
17
18#include "tclInt.h"
19#include "tclPort.h"
20
21#define FALSE 0
22#define TRUE 1
23
24/*
25 *----------------------------------------------------------------------
26 *
27 * Tcl_Alloc --
[adeddd8]28 * Interface to TclpAlloc.
29 * It does check that memory was actually allocated.
[d7d2da3]30 *
31 *----------------------------------------------------------------------
32 */
33
34char *
35Tcl_Alloc (size)
36 unsigned int size;
37{
38 char *result;
39
40 result = TclpAlloc(size);
41 if (result == NULL)
42 panic("unable to alloc %d bytes", size);
43 return result;
44}
45
46char *
47Tcl_DbCkalloc(size, file, line)
48 unsigned int size;
49 char *file;
50 int line;
51{
52 char *result;
53
54 result = (char *) TclpAlloc(size);
55
56 if (result == NULL) {
57 fflush(stdout);
58 panic("unable to alloc %d bytes, %s line %d", size, file,
59 line);
60 }
61 return result;
62}
63
64
65
66/*
67 *----------------------------------------------------------------------
68 *
[adeddd8]69 * Tcl_Realloc --
70 * Interface to TclpRealloc.
[d7d2da3]71 * It does check that memory was actually allocated.
72 *
73 *----------------------------------------------------------------------
74 */
75
76char *
77Tcl_Realloc(ptr, size)
78 char *ptr;
79 unsigned int size;
80{
81 char *result;
82
83 result = TclpRealloc(ptr, size);
84 if (result == NULL)
85 panic("unable to realloc %d bytes", size);
86 return result;
87}
88
89char *
90Tcl_DbCkrealloc(ptr, size, file, line)
91 char *ptr;
92 unsigned int size;
93 char *file;
94 int line;
95{
96 char *result;
97
98 result = (char *) TclpRealloc(ptr, size);
99
100 if (result == NULL) {
101 fflush(stdout);
102 panic("unable to realloc %d bytes, %s line %d", size, file,
103 line);
104 }
105 return result;
106}
107
108
109/*
110 *----------------------------------------------------------------------
[adeddd8]111 *
[d7d2da3]112 * Tcl_Free --
113 * Interface to TclpFree.
114 *
115 *----------------------------------------------------------------------
116 */
117
118void
119Tcl_Free (ptr)
120 char *ptr;
121{
122 TclpFree(ptr);
123}
Note: See TracBrowser for help on using the repository browser.