3 source/interpret.c | 16 ++++++++--------
4 source/interpret.h | 7 ++++---
5 2 files changed, 12 insertions(+), 11 deletions(-)
7 diff --quilt old/source/interpret.c new/source/interpret.c
8 --- old/source/interpret.c
9 +++ new/source/interpret.c
10 @@ -163,14 +163,14 @@ static void stackdump(int n, int extra);
11 static Symbol *GlobalSymList = NULL;
13 /* List of all memory allocated for strings */
14 static char *AllocatedStrings = NULL;
17 +typedef struct SparseArrayEntryWrapperTag {
18 SparseArrayEntry data; /* LEAVE this as top entry */
19 int inUse; /* we use pointers to the data to refer to the entire struct */
20 - struct SparseArrayEntryWrapper *next;
21 + struct SparseArrayEntryWrapperTag *next;
22 } SparseArrayEntryWrapper;
24 static SparseArrayEntryWrapper *AllocatedSparseArrayEntries = NULL;
26 /* Message strings used in macros (so they don't get repeated every time
27 @@ -894,11 +894,11 @@ int AllocNStringCpy(NString *string, con
28 static SparseArrayEntry *allocateSparseArrayEntry(void)
30 SparseArrayEntryWrapper *mem;
32 mem = (SparseArrayEntryWrapper *)XtMalloc(sizeof(SparseArrayEntryWrapper));
33 - mem->next = (struct SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
34 + mem->next = (SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
35 AllocatedSparseArrayEntries = mem;
36 #ifdef TRACK_GARBAGE_LEAKS
37 ++numAllocatedSparseArrayElements;
40 @@ -990,11 +990,11 @@ void GarbageCollectStrings(void)
41 AllocatedSparseArrayEntries = NULL;
42 while (nextAP != NULL) {
44 nextAP = (SparseArrayEntryWrapper *)nextAP->next;
45 if (thisAP->inUse != 0) {
46 - thisAP->next = (struct SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
47 + thisAP->next = (SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
48 AllocatedSparseArrayEntries = thisAP;
51 #ifdef TRACK_GARBAGE_LEAKS
52 --numAllocatedSparseArrayElements;
53 @@ -2283,13 +2283,13 @@ static void arrayDisposeNode(rbTreeNode
59 -struct SparseArrayEntry *ArrayNew(void)
60 +SparseArrayEntry *ArrayNew(void)
62 - return((struct SparseArrayEntry *)rbTreeNew(arrayEmptyAllocator));
63 + return((SparseArrayEntry *)rbTreeNew(arrayEmptyAllocator));
67 ** insert a DataValue into an array, allocate the array if needed
68 ** keyStr must be a string that was allocated with AllocString()
69 @@ -2609,11 +2609,11 @@ static int beginArrayIter(void)
70 iteratorValPtr->tag = INT_TAG;
71 if (arrayVal.tag != ARRAY_TAG) {
72 return(execError("can't iterate non-array", NULL));
75 - iteratorValPtr->val.arrayPtr = (struct SparseArrayEntry *)arrayIterateFirst(&arrayVal);
76 + iteratorValPtr->val.arrayPtr = (SparseArrayEntry *)arrayIterateFirst(&arrayVal);
81 ** copy key to symbol if node is still valid, marked bad by a color of -1
82 @@ -2678,11 +2678,11 @@ static int arrayIter(void)
83 if (thisEntry && thisEntry->nodePtrs.color != -1) {
84 itemValPtr->tag = STRING_TAG;
85 itemValPtr->val.str.rep = thisEntry->key;
86 itemValPtr->val.str.len = strlen(thisEntry->key);
88 - iteratorValPtr->val.arrayPtr = (struct SparseArrayEntry *)arrayIterateNext(thisEntry);
89 + iteratorValPtr->val.arrayPtr = (SparseArrayEntry *)arrayIterateNext(thisEntry);
95 diff --quilt old/source/interpret.h new/source/interpret.h
96 --- old/source/interpret.h
97 +++ new/source/interpret.h
98 @@ -55,10 +55,11 @@ enum typeTags {NO_TAG, INT_TAG, STRING_T
99 enum execReturnCodes {MACRO_TIME_LIMIT, MACRO_PREEMPT, MACRO_DONE, MACRO_ERROR};
101 #define ARRAY_DIM_SEP "\034"
104 +struct SparseArrayEntryTag;
108 typedef union InstTag {
110 @@ -82,15 +83,15 @@ typedef struct DataValueTag {
112 struct ProgramTag* prog;
115 struct DataValueTag* dataval;
116 - struct SparseArrayEntry *arrayPtr;
117 + struct SparseArrayEntryTag *arrayPtr;
122 +typedef struct SparseArrayEntryTag {
123 rbTreeNode nodePtrs; /* MUST BE FIRST ENTRY */
128 @@ -119,11 +120,11 @@ typedef struct {
130 void InitMacroGlobals(void);
132 SparseArrayEntry *arrayIterateFirst(DataValue *theArray);
133 SparseArrayEntry *arrayIterateNext(SparseArrayEntry *iterator);
134 -struct SparseArrayEntry *ArrayNew(void);
135 +SparseArrayEntry *ArrayNew(void);
136 Boolean ArrayInsert(DataValue* theArray, char* keyStr, DataValue* theValue);
137 void ArrayDelete(DataValue *theArray, char *keyStr);
138 void ArrayDeleteAll(DataValue *theArray);
139 unsigned ArraySize(DataValue *theArray);
140 Boolean ArrayGet(DataValue* theArray, char* keyStr, DataValue* theValue);