Skip to content

Commit 34f38fa

Browse files
author
jan.nijtmans
committed
Incease some fields in ItclPreserveInfo from int to size_t. Only used when debugging. Also add a ".project" file, handy for Eclipse.
1 parent 872cd15 commit 34f38fa

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>itcl</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>

generic/itclInt.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ typedef struct ItclPreserveInfoEntry {
103103
} ItclPreserveInfoEntry;
104104

105105
typedef struct ItclPreserveInfo {
106-
int refCount;
106+
size_t refCount;
107107
ClientData clientData;
108-
int size;
109-
int numEntries;
108+
size_t size;
109+
size_t numEntries;
110110
ItclPreserveInfoEntry *entries;
111111
} ItclPreserveInfo;
112112

generic/itclMethod.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,7 @@ Itcl_UnsetContext(
14601460
Itcl_DeleteStack(stackPtr);
14611461
ckfree((char *) stackPtr);
14621462
Tcl_DeleteHashEntry(hPtr);
1463-
contextPtr->refCount--;
1464-
if (contextPtr->refCount) {
1463+
if (--contextPtr->refCount) {
14651464
Tcl_Panic("frame context ref count not zero!");
14661465
}
14671466
ckfree((char *)contextPtr);

generic/itclUtil.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ Itcl_DbDumpPreserveInfo(
575575
FILE *fd;
576576
ItclPreserveInfo *ipiPtr;
577577
ItclPreserveInfoEntry *ipiePtr;
578-
int j;
578+
size_t j;
579579

580580
if (fileName == NULL) {
581581
fd = stderr;
@@ -587,7 +587,7 @@ Itcl_DbDumpPreserveInfo(
587587
if (ipiPtr->refCount == 0) {
588588
continue;
589589
}
590-
fprintf(stderr, "DAT!%p!%d!\n", ipiPtr->clientData, ipiPtr->refCount);
590+
fprintf(stderr, "DAT!%p!%" TCL_LL_MODIFIER "u!\n", ipiPtr->clientData, (Tcl_WideUInt) ipiPtr->refCount);
591591
for (j = 0; j < ipiPtr->numEntries; j++) {
592592
ipiePtr = &ipiPtr->entries[j];
593593
if (ipiePtr->type != ITCL_PRESERVE_DELETED) {
@@ -734,8 +734,7 @@ ItclDbgReleaseData(
734734
ipiePtr->type = ITCL_PRESERVE_DECR;
735735
ipiePtr->line = line;
736736
ipiePtr->fileName = file;
737-
ipiPtr->refCount--;
738-
if (ipiPtr->refCount < 0) {
737+
if (ipiPtr->refCount-- == 0) {
739738
fprintf(stderr, "REFCOUNT < 0 for: %p!\n", cdata);
740739
noDelete = 1;
741740
}

0 commit comments

Comments
 (0)