| 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 |
#if !defined(TCL_THREADS) || !defined(USE_THREAD_ALLOC) |
| 27 |
|
| 28 |
#include "tclInt.h" |
| 29 |
#include "tclPort.h" |
| 30 |
|
| 31 |
#if USE_TCLALLOC |
| 32 |
|
| 33 |
#ifdef TCL_DEBUG |
| 34 |
# define DEBUG |
| 35 |
|
| 36 |
# define RCHECK |
| 37 |
#endif |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#if defined(MAC_TCL) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__BORLANDC__) |
| 44 |
typedef unsigned long caddr_t; |
| 45 |
#endif |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
union overhead { |
| 59 |
union overhead *ov_next; |
| 60 |
unsigned char ov_padding[8]; |
| 61 |
struct { |
| 62 |
unsigned char ovu_magic0; |
| 63 |
unsigned char ovu_index; |
| 64 |
unsigned char ovu_unused; |
| 65 |
unsigned char ovu_magic1; |
| 66 |
#ifdef RCHECK |
| 67 |
unsigned short ovu_rmagic; |
| 68 |
unsigned long ovu_size; |
| 69 |
unsigned short ovu_unused2; |
| 70 |
#endif |
| 71 |
} ovu; |
| 72 |
#define ov_magic0 ovu.ovu_magic0 |
| 73 |
#define ov_magic1 ovu.ovu_magic1 |
| 74 |
#define ov_index ovu.ovu_index |
| 75 |
#define ov_rmagic ovu.ovu_rmagic |
| 76 |
#define ov_size ovu.ovu_size |
| 77 |
}; |
| 78 |
|
| 79 |
|
| 80 |
#define MAGIC 0xef |
| 81 |
#define RMAGIC 0x5555 |
| 82 |
|
| 83 |
#ifdef RCHECK |
| 84 |
#define RSLOP sizeof (unsigned short) |
| 85 |
#else |
| 86 |
#define RSLOP 0 |
| 87 |
#endif |
| 88 |
|
| 89 |
#define OVERHEAD (sizeof(union overhead) + RSLOP) |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
#define NBUCKETS 13 |
| 98 |
#define MAXMALLOC (1<<(NBUCKETS+2)) |
| 99 |
static union overhead *nextf[NBUCKETS]; |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
struct block { |
| 108 |
struct block *nextPtr; |
| 109 |
struct block *prevPtr; |
| 110 |
|
| 111 |
}; |
| 112 |
|
| 113 |
static struct block *blockList; |
| 114 |
static struct block bigBlocks = { |
| 115 |
&bigBlocks, &bigBlocks |
| 116 |
}; |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
#ifdef TCL_THREADS |
| 126 |
static Tcl_Mutex *allocMutexPtr; |
| 127 |
#endif |
| 128 |
static int allocInit = 0; |
| 129 |
|
| 130 |
|
| 131 |
#ifdef MSTATS |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
static unsigned int nmalloc[NBUCKETS+1]; |
| 139 |
#include <stdio.h> |
| 140 |
#endif |
| 141 |
|
| 142 |
#if defined(DEBUG) || defined(RCHECK) |
| 143 |
#define ASSERT(p) if (!(p)) panic(# p) |
| 144 |
#define RANGE_ASSERT(p) if (!(p)) panic(# p) |
| 145 |
#else |
| 146 |
#define ASSERT(p) |
| 147 |
#define RANGE_ASSERT(p) |
| 148 |
#endif |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
static void MoreCore _ANSI_ARGS_((int bucket)); |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
void |
| 174 |
TclInitAlloc() |
| 175 |
{ |
| 176 |
if (!allocInit) { |
| 177 |
allocInit = 1; |
| 178 |
#ifdef TCL_THREADS |
| 179 |
allocMutexPtr = Tcl_GetAllocMutex(); |
| 180 |
#endif |
| 181 |
} |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
void |
| 209 |
TclFinalizeAllocSubsystem() |
| 210 |
{ |
| 211 |
int i; |
| 212 |
struct block *blockPtr, *nextPtr; |
| 213 |
|
| 214 |
Tcl_MutexLock(allocMutexPtr); |
| 215 |
for (blockPtr = blockList; blockPtr != NULL; blockPtr = nextPtr) { |
| 216 |
nextPtr = blockPtr->nextPtr; |
| 217 |
TclpSysFree(blockPtr); |
| 218 |
} |
| 219 |
blockList = NULL; |
| 220 |
|
| 221 |
for (blockPtr = bigBlocks.nextPtr; blockPtr != &bigBlocks; ) { |
| 222 |
nextPtr = blockPtr->nextPtr; |
| 223 |
TclpSysFree(blockPtr); |
| 224 |
blockPtr = nextPtr; |
| 225 |
} |
| 226 |
bigBlocks.nextPtr = &bigBlocks; |
| 227 |
bigBlocks.prevPtr = &bigBlocks; |
| 228 |
|
| 229 |
for (i = 0; i < NBUCKETS; i++) { |
| 230 |
nextf[i] = NULL; |
| 231 |
#ifdef MSTATS |
| 232 |
nmalloc[i] = 0; |
| 233 |
#endif |
| 234 |
} |
| 235 |
#ifdef MSTATS |
| 236 |
nmalloc[i] = 0; |
| 237 |
#endif |
| 238 |
Tcl_MutexUnlock(allocMutexPtr); |
| 239 |
} |
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
char * |
| 258 |
TclpAlloc(nbytes) |
| 259 |
unsigned int nbytes; |
| 260 |
{ |
| 261 |
register union overhead *op; |
| 262 |
register long bucket; |
| 263 |
register unsigned amt; |
| 264 |
struct block *bigBlockPtr; |
| 265 |
|
| 266 |
if (!allocInit) { |
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
TclInitAlloc(); |
| 273 |
} |
| 274 |
Tcl_MutexLock(allocMutexPtr); |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
if (nbytes + OVERHEAD >= MAXMALLOC) { |
| 279 |
bigBlockPtr = (struct block *) TclpSysAlloc((unsigned) |
| 280 |
(sizeof(struct block) + OVERHEAD + nbytes), 0); |
| 281 |
if (bigBlockPtr == NULL) { |
| 282 |
Tcl_MutexUnlock(allocMutexPtr); |
| 283 |
return NULL; |
| 284 |
} |
| 285 |
bigBlockPtr->nextPtr = bigBlocks.nextPtr; |
| 286 |
bigBlocks.nextPtr = bigBlockPtr; |
| 287 |
bigBlockPtr->prevPtr = &bigBlocks; |
| 288 |
bigBlockPtr->nextPtr->prevPtr = bigBlockPtr; |
| 289 |
|
| 290 |
op = (union overhead *) (bigBlockPtr + 1); |
| 291 |
op->ov_magic0 = op->ov_magic1 = MAGIC; |
| 292 |
op->ov_index = 0xff; |
| 293 |
#ifdef MSTATS |
| 294 |
nmalloc[NBUCKETS]++; |
| 295 |
#endif |
| 296 |
#ifdef RCHECK |
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); |
| 302 |
op->ov_rmagic = RMAGIC; |
| 303 |
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; |
| 304 |
#endif |
| 305 |
Tcl_MutexUnlock(allocMutexPtr); |
| 306 |
return (void *)(op+1); |
| 307 |
} |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
#ifndef RCHECK |
| 314 |
amt = 8; |
| 315 |
bucket = 0; |
| 316 |
#else |
| 317 |
amt = 16; |
| 318 |
bucket = 1; |
| 319 |
#endif |
| 320 |
while (nbytes + OVERHEAD > amt) { |
| 321 |
amt <<= 1; |
| 322 |
if (amt == 0) { |
| 323 |
Tcl_MutexUnlock(allocMutexPtr); |
| 324 |
return (NULL); |
| 325 |
} |
| 326 |
bucket++; |
| 327 |
} |
| 328 |
ASSERT( bucket < NBUCKETS ); |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
if ((op = nextf[bucket]) == NULL) { |
| 335 |
MoreCore(bucket); |
| 336 |
if ((op = nextf[bucket]) == NULL) { |
| 337 |
Tcl_MutexUnlock(allocMutexPtr); |
| 338 |
return (NULL); |
| 339 |
} |
| 340 |
} |
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
nextf[bucket] = op->ov_next; |
| 345 |
op->ov_magic0 = op->ov_magic1 = MAGIC; |
| 346 |
op->ov_index = (unsigned char) bucket; |
| 347 |
#ifdef MSTATS |
| 348 |
nmalloc[bucket]++; |
| 349 |
#endif |
| 350 |
#ifdef RCHECK |
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); |
| 356 |
op->ov_rmagic = RMAGIC; |
| 357 |
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; |
| 358 |
#endif |
| 359 |
Tcl_MutexUnlock(allocMutexPtr); |
| 360 |
return ((char *)(op + 1)); |
| 361 |
} |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
static void |
| 382 |
MoreCore(bucket) |
| 383 |
int bucket; |
| 384 |
{ |
| 385 |
register union overhead *op; |
| 386 |
register long sz; |
| 387 |
long amt; |
| 388 |
int nblks; |
| 389 |
struct block *blockPtr; |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
sz = 1 << (bucket + 3); |
| 396 |
ASSERT(sz > 0); |
| 397 |
|
| 398 |
amt = MAXMALLOC; |
| 399 |
nblks = amt / sz; |
| 400 |
ASSERT(nblks*sz == amt); |
| 401 |
|
| 402 |
blockPtr = (struct block *) TclpSysAlloc((unsigned) |
| 403 |
(sizeof(struct block) + amt), 1); |
| 404 |
|
| 405 |
if (blockPtr == NULL) { |
| 406 |
return; |
| 407 |
} |
| 408 |
blockPtr->nextPtr = blockList; |
| 409 |
blockList = blockPtr; |
| 410 |
|
| 411 |
op = (union overhead *) (blockPtr + 1); |
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
nextf[bucket] = op; |
| 418 |
while (--nblks > 0) { |
| 419 |
op->ov_next = (union overhead *)((caddr_t)op + sz); |
| 420 |
op = (union overhead *)((caddr_t)op + sz); |
| 421 |
} |
| 422 |
op->ov_next = (union overhead *)NULL; |
| 423 |
} |
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
void |
| 442 |
TclpFree(cp) |
| 443 |
char *cp; |
| 444 |
{ |
| 445 |
register long size; |
| 446 |
register union overhead *op; |
| 447 |
struct block *bigBlockPtr; |
| 448 |
|
| 449 |
if (cp == NULL) { |
| 450 |
return; |
| 451 |
} |
| 452 |
|
| 453 |
Tcl_MutexLock(allocMutexPtr); |
| 454 |
op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); |
| 455 |
|
| 456 |
ASSERT(op->ov_magic0 == MAGIC); |
| 457 |
ASSERT(op->ov_magic1 == MAGIC); |
| 458 |
if (op->ov_magic0 != MAGIC || op->ov_magic1 != MAGIC) { |
| 459 |
Tcl_MutexUnlock(allocMutexPtr); |
| 460 |
return; |
| 461 |
} |
| 462 |
|
| 463 |
RANGE_ASSERT(op->ov_rmagic == RMAGIC); |
| 464 |
RANGE_ASSERT(*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC); |
| 465 |
size = op->ov_index; |
| 466 |
if ( size == 0xff ) { |
| 467 |
#ifdef MSTATS |
| 468 |
nmalloc[NBUCKETS]--; |
| 469 |
#endif |
| 470 |
bigBlockPtr = (struct block *) op - 1; |
| 471 |
bigBlockPtr->prevPtr->nextPtr = bigBlockPtr->nextPtr; |
| 472 |
bigBlockPtr->nextPtr->prevPtr = bigBlockPtr->prevPtr; |
| 473 |
TclpSysFree(bigBlockPtr); |
| 474 |
Tcl_MutexUnlock(allocMutexPtr); |
| 475 |
return; |
| 476 |
} |
| 477 |
ASSERT(size < NBUCKETS); |
| 478 |
op->ov_next = nextf[size]; |
| 479 |
nextf[size] = op; |
| 480 |
#ifdef MSTATS |
| 481 |
nmalloc[size]--; |
| 482 |
#endif |
| 483 |
Tcl_MutexUnlock(allocMutexPtr); |
| 484 |
} |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
char * |
| 503 |
TclpRealloc(cp, nbytes) |
| 504 |
char *cp; |
| 505 |
unsigned int nbytes; |
| 506 |
{ |
| 507 |
int i; |
| 508 |
union overhead *op; |
| 509 |
struct block *bigBlockPtr; |
| 510 |
int expensive; |
| 511 |
unsigned long maxsize; |
| 512 |
|
| 513 |
if (cp == NULL) { |
| 514 |
return (TclpAlloc(nbytes)); |
| 515 |
} |
| 516 |
|
| 517 |
Tcl_MutexLock(allocMutexPtr); |
| 518 |
|
| 519 |
op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); |
| 520 |
|
| 521 |
ASSERT(op->ov_magic0 == MAGIC); |
| 522 |
ASSERT(op->ov_magic1 == MAGIC); |
| 523 |
if (op->ov_magic0 != MAGIC || op->ov_magic1 != MAGIC) { |
| 524 |
Tcl_MutexUnlock(allocMutexPtr); |
| 525 |
return NULL; |
| 526 |
} |
| 527 |
|
| 528 |
RANGE_ASSERT(op->ov_rmagic == RMAGIC); |
| 529 |
RANGE_ASSERT(*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC); |
| 530 |
i = op->ov_index; |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
if (i == 0xff) { |
| 537 |
struct block *prevPtr, *nextPtr; |
| 538 |
bigBlockPtr = (struct block *) op - 1; |
| 539 |
prevPtr = bigBlockPtr->prevPtr; |
| 540 |
nextPtr = bigBlockPtr->nextPtr; |
| 541 |
bigBlockPtr = (struct block *) TclpSysRealloc(bigBlockPtr, |
| 542 |
sizeof(struct block) + OVERHEAD + nbytes); |
| 543 |
if (bigBlockPtr == NULL) { |
| 544 |
Tcl_MutexUnlock(allocMutexPtr); |
| 545 |
return NULL; |
| 546 |
} |
| 547 |
|
| 548 |
if (prevPtr->nextPtr != bigBlockPtr) { |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
prevPtr->nextPtr = bigBlockPtr; |
| 555 |
nextPtr->prevPtr = bigBlockPtr; |
| 556 |
} |
| 557 |
|
| 558 |
op = (union overhead *) (bigBlockPtr + 1); |
| 559 |
#ifdef MSTATS |
| 560 |
nmalloc[NBUCKETS]++; |
| 561 |
#endif |
| 562 |
#ifdef RCHECK |
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); |
| 568 |
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; |
| 569 |
#endif |
| 570 |
Tcl_MutexUnlock(allocMutexPtr); |
| 571 |
return (char *)(op+1); |
| 572 |
} |
| 573 |
maxsize = 1 << (i+3); |
| 574 |
expensive = 0; |
| 575 |
if ( nbytes + OVERHEAD > maxsize ) { |
| 576 |
expensive = 1; |
| 577 |
} else if ( i > 0 && nbytes + OVERHEAD < (maxsize/2) ) { |
| 578 |
expensive = 1; |
| 579 |
} |
| 580 |
|
| 581 |
if (expensive) { |
| 582 |
void *newp; |
| 583 |
|
| 584 |
Tcl_MutexUnlock(allocMutexPtr); |
| 585 |
|
| 586 |
newp = TclpAlloc(nbytes); |
| 587 |
if ( newp == NULL ) { |
| 588 |
return NULL; |
| 589 |
} |
| 590 |
maxsize -= OVERHEAD; |
| 591 |
if ( maxsize < nbytes ) |
| 592 |
nbytes = maxsize; |
| 593 |
memcpy((VOID *) newp, (VOID *) cp, (size_t) nbytes); |
| 594 |
TclpFree(cp); |
| 595 |
return newp; |
| 596 |
} |
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
#ifdef RCHECK |
| 602 |
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); |
| 603 |
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; |
| 604 |
#endif |
| 605 |
Tcl_MutexUnlock(allocMutexPtr); |
| 606 |
return(cp); |
| 607 |
} |
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
#ifdef MSTATS |
| 628 |
void |
| 629 |
mstats(s) |
| 630 |
char *s; |
| 631 |
{ |
| 632 |
register int i, j; |
| 633 |
register union overhead *p; |
| 634 |
int totfree = 0, |
| 635 |
totused = 0; |
| 636 |
|
| 637 |
Tcl_MutexLock(allocMutexPtr); |
| 638 |
fprintf(stderr, "Memory allocation statistics %s\nTclpFree:\t", s); |
| 639 |
for (i = 0; i < NBUCKETS; i++) { |
| 640 |
for (j = 0, p = nextf[i]; p; p = p->ov_next, j++) |
| 641 |
fprintf(stderr, " %d", j); |
| 642 |
totfree += j * (1 << (i + 3)); |
| 643 |
} |
| 644 |
fprintf(stderr, "\nused:\t"); |
| 645 |
for (i = 0; i < NBUCKETS; i++) { |
| 646 |
fprintf(stderr, " %d", nmalloc[i]); |
| 647 |
totused += nmalloc[i] * (1 << (i + 3)); |
| 648 |
} |
| 649 |
fprintf(stderr, "\n\tTotal small in use: %d, total free: %d\n", |
| 650 |
totused, totfree); |
| 651 |
fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %d\n", |
| 652 |
MAXMALLOC, nmalloc[NBUCKETS]); |
| 653 |
Tcl_MutexUnlock(allocMutexPtr); |
| 654 |
} |
| 655 |
#endif |
| 656 |
|
| 657 |
#else |
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
char * |
| 676 |
TclpAlloc(nbytes) |
| 677 |
unsigned int nbytes; |
| 678 |
{ |
| 679 |
return (char*) malloc(nbytes); |
| 680 |
} |
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
void |
| 699 |
TclpFree(cp) |
| 700 |
char *cp; |
| 701 |
{ |
| 702 |
free(cp); |
| 703 |
return; |
| 704 |
} |
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
char * |
| 723 |
TclpRealloc(cp, nbytes) |
| 724 |
char *cp; |
| 725 |
unsigned int nbytes; |
| 726 |
{ |
| 727 |
return (char*) realloc(cp, nbytes); |
| 728 |
} |
| 729 |
|
| 730 |
#endif |
| 731 |
#endif |