1 |
dashley |
25 |
/* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tcl_base/tclalloc.c,v 1.4 2001/07/15 06:44:32 dtashley Exp $ */
|
2 |
|
|
|
3 |
|
|
/* IJS_SM_FILE_PUBLIC */
|
4 |
|
|
|
5 |
|
|
#define MODULE_TCLALLOC
|
6 |
|
|
|
7 |
|
|
#include <malloc.h>
|
8 |
|
|
|
9 |
|
|
#include "tclalloc.h"
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/*
|
13 |
|
|
*----------------------------------------------------------------------
|
14 |
|
|
*
|
15 |
|
|
* TclpAlloc --
|
16 |
|
|
*
|
17 |
|
|
* Allocate more memory.
|
18 |
|
|
*
|
19 |
|
|
* Results:
|
20 |
|
|
* None.
|
21 |
|
|
*
|
22 |
|
|
* Side effects:
|
23 |
|
|
* None.
|
24 |
|
|
*
|
25 |
|
|
*----------------------------------------------------------------------
|
26 |
|
|
*/
|
27 |
|
|
|
28 |
|
|
char *TclpAlloc(unsigned int nbytes)
|
29 |
|
|
{
|
30 |
|
|
return (char*) malloc(nbytes);
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
/*
|
35 |
|
|
*----------------------------------------------------------------------
|
36 |
|
|
*
|
37 |
|
|
* TclpFree --
|
38 |
|
|
*
|
39 |
|
|
* Free memory.
|
40 |
|
|
*
|
41 |
|
|
* Results:
|
42 |
|
|
* None.
|
43 |
|
|
*
|
44 |
|
|
* Side effects:
|
45 |
|
|
* None.
|
46 |
|
|
*
|
47 |
|
|
*----------------------------------------------------------------------
|
48 |
|
|
*/
|
49 |
|
|
|
50 |
|
|
void TclpFree(char *cp)
|
51 |
|
|
{
|
52 |
|
|
free(cp);
|
53 |
|
|
return;
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
/*
|
58 |
|
|
*----------------------------------------------------------------------
|
59 |
|
|
*
|
60 |
|
|
* TclpCalloc --
|
61 |
|
|
*
|
62 |
|
|
* Allocate array of memory.
|
63 |
|
|
*
|
64 |
|
|
* Results:
|
65 |
|
|
* None.
|
66 |
|
|
*
|
67 |
|
|
* Side effects:
|
68 |
|
|
* None.
|
69 |
|
|
*
|
70 |
|
|
*----------------------------------------------------------------------
|
71 |
|
|
*/
|
72 |
|
|
|
73 |
|
|
char *TclpCalloc(size_t num, size_t size)
|
74 |
|
|
{
|
75 |
|
|
return (char*) calloc(num, size);
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
/*
|
80 |
|
|
*----------------------------------------------------------------------
|
81 |
|
|
*
|
82 |
|
|
* TclpRealloc --
|
83 |
|
|
*
|
84 |
|
|
* Reallocate memory.
|
85 |
|
|
*
|
86 |
|
|
* Results:
|
87 |
|
|
* None.
|
88 |
|
|
*
|
89 |
|
|
* Side effects:
|
90 |
|
|
* None.
|
91 |
|
|
*
|
92 |
|
|
*----------------------------------------------------------------------
|
93 |
|
|
*/
|
94 |
|
|
|
95 |
|
|
char *TclpRealloc(char *cp, unsigned int nbytes)
|
96 |
|
|
{
|
97 |
|
|
return (char*) realloc(cp, nbytes);
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
/*
|
102 |
|
|
*----------------------------------------------------------------------
|
103 |
|
|
*
|
104 |
|
|
* TclpCversion --
|
105 |
|
|
*
|
106 |
|
|
* Returns the PVCS version control string for the .C file.
|
107 |
|
|
* This is a constant string and may not be modified.
|
108 |
|
|
*
|
109 |
|
|
* Side effects:
|
110 |
|
|
* None.
|
111 |
|
|
*
|
112 |
|
|
*----------------------------------------------------------------------
|
113 |
|
|
*/
|
114 |
|
|
|
115 |
|
|
const char *TclpCversion(void)
|
116 |
|
|
{
|
117 |
|
|
return ("$Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tcl_base/tclalloc.c,v 1.4 2001/07/15 06:44:32 dtashley Exp $");
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
/*
|
122 |
|
|
*----------------------------------------------------------------------
|
123 |
|
|
*
|
124 |
|
|
* TclpHversion --
|
125 |
|
|
*
|
126 |
|
|
* Returns the PVCS version control string for the .H file.
|
127 |
|
|
* This is a constant string and may not be modified.
|
128 |
|
|
*
|
129 |
|
|
* Side effects:
|
130 |
|
|
* None.
|
131 |
|
|
*
|
132 |
|
|
*----------------------------------------------------------------------
|
133 |
|
|
*/
|
134 |
|
|
|
135 |
|
|
const char *TclpHversion(void)
|
136 |
|
|
{
|
137 |
|
|
return (TCLALLOC_H_VERSION);
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
/*
|
142 |
|
|
* $Log: tclalloc.c,v $
|
143 |
|
|
* Revision 1.4 2001/07/15 06:44:32 dtashley
|
144 |
|
|
* Keyword expansion mistake corrected.
|
145 |
|
|
*
|
146 |
|
|
* Revision 1.3 2001/07/15 06:40:10 dtashley
|
147 |
|
|
* Adaptation of GNU arbitrary-size integer package integrated into IjuScripter
|
148 |
|
|
* and IjuConsole.
|
149 |
|
|
*
|
150 |
|
|
* Revision 1.2 2001/07/15 06:07:15 dtashley
|
151 |
|
|
* Moved out of binary mode, preparing for use with CVS.
|
152 |
|
|
*/
|
153 |
|
|
/* $History: tclalloc.c $
|
154 |
|
|
*
|
155 |
|
|
* ***************** Version 1 *****************
|
156 |
|
|
* User: Dtashley Date: 1/02/01 Time: 12:16a
|
157 |
|
|
* Created in $/IjuScripter, IjuConsole/Source/Tcl Base
|
158 |
|
|
* Initial check-in.
|
159 |
|
|
*/
|
160 |
|
|
|
161 |
|
|
/*************************************************************************/
|
162 |
|
|
/* Original copyright notice below. This must be retained in the */
|
163 |
|
|
/* source code. */
|
164 |
|
|
/*************************************************************************/
|
165 |
|
|
|
166 |
|
|
/*
|
167 |
|
|
* tclAlloc.c --
|
168 |
|
|
*
|
169 |
|
|
* This is a very fast storage allocator. It allocates blocks of a
|
170 |
|
|
* small number of different sizes, and keeps free lists of each size.
|
171 |
|
|
* Blocks that don't exactly fit are passed up to the next larger size.
|
172 |
|
|
* Blocks over a certain size are directly allocated from the system.
|
173 |
|
|
*
|
174 |
|
|
* Copyright (c) 1983 Regents of the University of California.
|
175 |
|
|
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
|
176 |
|
|
* Copyright (c) 1998-1999 by Scriptics Corporation.
|
177 |
|
|
*
|
178 |
|
|
* Portions contributed by Chris Kingsley, Jack Jansen and Ray Johnson.
|
179 |
|
|
*
|
180 |
|
|
* See the file "license.terms" for information on usage and redistribution
|
181 |
|
|
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
182 |
|
|
*
|
183 |
|
|
* RCS: @(#) $Id: tclalloc.c,v 1.4 2001/07/15 06:44:32 dtashley Exp $
|
184 |
|
|
*/
|
185 |
|
|
|
186 |
|
|
/* End of TCLALLOC.C */ |