there is only a 

typedef struct {
    ...
} SparseArrayEntry;

This patch introduce a 'struct SparseArrayEntryTag' and convert all previously 
incorrect uses of struct SparseArrayEntry to SparseArrayEntry.

And do the same with struct SparseArrayEntryWrapper.

Regards
Bert

---

 source/interpret.c |   16 ++++++++--------
 source/interpret.h |    7 ++++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --quilt old/source/interpret.c new/source/interpret.c
--- old/source/interpret.c
+++ new/source/interpret.c
@@ -163,14 +163,14 @@ static void stackdump(int n, int extra);
 static Symbol *GlobalSymList = NULL;
 
 /* List of all memory allocated for strings */
 static char *AllocatedStrings = NULL;
 
-typedef struct {
+typedef struct SparseArrayEntryWrapperTag {
     SparseArrayEntry   data; /* LEAVE this as top entry */
     int inUse;              /* we use pointers to the data to refer to the 
entire struct */
-    struct SparseArrayEntryWrapper *next;
+    struct SparseArrayEntryWrapperTag *next;
 } SparseArrayEntryWrapper;
 
 static SparseArrayEntryWrapper *AllocatedSparseArrayEntries = NULL; 
 
 /* Message strings used in macros (so they don't get repeated every time
@@ -894,11 +894,11 @@ int AllocNStringCpy(NString *string, con
 static SparseArrayEntry *allocateSparseArrayEntry(void)
 {
     SparseArrayEntryWrapper *mem;
 
     mem = (SparseArrayEntryWrapper *)XtMalloc(sizeof(SparseArrayEntryWrapper));
-    mem->next = (struct SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
+    mem->next = (SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
     AllocatedSparseArrayEntries = mem;
 #ifdef TRACK_GARBAGE_LEAKS
     ++numAllocatedSparseArrayElements;
 #endif
     return(&(mem->data));
@@ -990,11 +990,11 @@ void GarbageCollectStrings(void)
     AllocatedSparseArrayEntries = NULL;
     while (nextAP != NULL) {
         thisAP = nextAP;
         nextAP = (SparseArrayEntryWrapper *)nextAP->next;
         if (thisAP->inUse != 0) {
-            thisAP->next = (struct SparseArrayEntryWrapper 
*)AllocatedSparseArrayEntries;
+            thisAP->next = (SparseArrayEntryWrapper 
*)AllocatedSparseArrayEntries;
             AllocatedSparseArrayEntries = thisAP;
         }
         else {
 #ifdef TRACK_GARBAGE_LEAKS
             --numAllocatedSparseArrayElements;
@@ -2283,13 +2283,13 @@ static void arrayDisposeNode(rbTreeNode 
     src->right = NULL;
     src->parent = NULL;
     src->color = -1;
 }
 
-struct SparseArrayEntry *ArrayNew(void)
+SparseArrayEntry *ArrayNew(void)
 {
-       return((struct SparseArrayEntry *)rbTreeNew(arrayEmptyAllocator));
+       return((SparseArrayEntry *)rbTreeNew(arrayEmptyAllocator));
 }
 
 /*
 ** insert a DataValue into an array, allocate the array if needed
 ** keyStr must be a string that was allocated with AllocString()
@@ -2609,11 +2609,11 @@ static int beginArrayIter(void)
     iteratorValPtr->tag = INT_TAG;
     if (arrayVal.tag != ARRAY_TAG) {
         return(execError("can't iterate non-array", NULL));
     }
 
-    iteratorValPtr->val.arrayPtr = (struct SparseArrayEntry 
*)arrayIterateFirst(&arrayVal);
+    iteratorValPtr->val.arrayPtr = (SparseArrayEntry 
*)arrayIterateFirst(&arrayVal);
     return(STAT_OK);
 }
 
 /*
 ** copy key to symbol if node is still valid, marked bad by a color of -1
@@ -2678,11 +2678,11 @@ static int arrayIter(void)
     if (thisEntry && thisEntry->nodePtrs.color != -1) {
         itemValPtr->tag = STRING_TAG;
         itemValPtr->val.str.rep = thisEntry->key;
         itemValPtr->val.str.len = strlen(thisEntry->key);
         
-        iteratorValPtr->val.arrayPtr = (struct SparseArrayEntry 
*)arrayIterateNext(thisEntry);
+        iteratorValPtr->val.arrayPtr = (SparseArrayEntry 
*)arrayIterateNext(thisEntry);
     }
     else {
         PC = branchAddr;
     }
     return(STAT_OK);
diff --quilt old/source/interpret.h new/source/interpret.h
--- old/source/interpret.h
+++ new/source/interpret.h
@@ -55,10 +55,11 @@ enum typeTags {NO_TAG, INT_TAG, STRING_T
 enum execReturnCodes {MACRO_TIME_LIMIT, MACRO_PREEMPT, MACRO_DONE, 
MACRO_ERROR};
 
 #define ARRAY_DIM_SEP "\034"
 
 struct DataValueTag;
+struct SparseArrayEntryTag;
 struct ProgramTag;
 struct SymbolRec;
 
 typedef union InstTag {
     int (*func)(void);
@@ -82,15 +83,15 @@ typedef struct DataValueTag {
         BuiltInSubr subr;
         struct ProgramTag* prog;
         XtActionProc xtproc;
         Inst* inst;
         struct DataValueTag* dataval;
-        struct SparseArrayEntry *arrayPtr;
+        struct SparseArrayEntryTag *arrayPtr;
     } val;
 } DataValue;
 
-typedef struct {
+typedef struct SparseArrayEntryTag {
     rbTreeNode nodePtrs; /* MUST BE FIRST ENTRY */
     char *key;
     DataValue value;
 } SparseArrayEntry;
 
@@ -119,11 +120,11 @@ typedef struct {
 
 void InitMacroGlobals(void);
 
 SparseArrayEntry *arrayIterateFirst(DataValue *theArray);
 SparseArrayEntry *arrayIterateNext(SparseArrayEntry *iterator);
-struct SparseArrayEntry *ArrayNew(void);
+SparseArrayEntry *ArrayNew(void);
 Boolean ArrayInsert(DataValue* theArray, char* keyStr, DataValue* theValue);
 void ArrayDelete(DataValue *theArray, char *keyStr);
 void ArrayDeleteAll(DataValue *theArray);
 unsigned ArraySize(DataValue *theArray);
 Boolean ArrayGet(DataValue* theArray, char* keyStr, DataValue* theValue);
-- 
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop

Reply via email to