From 29960c78c54cb04b37bab2ff058ef00558c73f89 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 4 Feb 2008 20:38:45 +0100 Subject: [PATCH] remove unused casts patches: there-is-no-struct-SparseArrayEntry B.W. --- extend-for-key-in-array-syntax.patch | 6 +-- there-is-no-struct-SparseArrayEntry.patch | 75 +++++++++++++++++++++++++++---- 2 files changed, 69 insertions(+), 12 deletions(-) diff --git a/extend-for-key-in-array-syntax.patch b/extend-for-key-in-array-syntax.patch index b9363c9..6ccd844 100644 --- a/extend-for-key-in-array-syntax.patch +++ b/extend-for-key-in-array-syntax.patch @@ -25,7 +25,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** the stack frame ** arrayVal is the data value holding the array in question @@ -3296,74 +3296,105 @@ static int beginArrayIter(void) - iteratorValPtr->val.arrayPtr = (SparseArrayEntry *)arrayIterateFirst(&arrayVal); + iteratorValPtr->val.arrayPtr = arrayIterateFirst(&arrayVal); return(STAT_OK); } @@ -129,7 +129,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return(execError("bad temporary iterator: %s", iterator->name)); } - thisEntry = (SparseArrayEntry *)iteratorValPtr->val.arrayPtr; + thisEntry = iteratorValPtr->val.arrayPtr; if (thisEntry && thisEntry->nodePtrs.color != -1) { - itemValPtr->tag = STRING_TAG; - itemValPtr->val.str.rep = thisEntry->key; @@ -146,7 +146,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c + } + + /* advance iterator */ - iteratorValPtr->val.arrayPtr = (SparseArrayEntry *)arrayIterateNext(thisEntry); + iteratorValPtr->val.arrayPtr = arrayIterateNext(thisEntry); } else { PC = branchAddr; diff --git a/there-is-no-struct-SparseArrayEntry.patch b/there-is-no-struct-SparseArrayEntry.patch index 63775e6..83303a4 100644 --- a/there-is-no-struct-SparseArrayEntry.patch +++ b/there-is-no-struct-SparseArrayEntry.patch @@ -1,8 +1,8 @@ --- - source/interpret.c | 16 ++++++++-------- + source/interpret.c | 28 ++++++++++++++-------------- source/interpret.h | 7 ++++--- - 2 files changed, 12 insertions(+), 11 deletions(-) + 2 files changed, 18 insertions(+), 17 deletions(-) diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c @@ -31,25 +31,75 @@ diff --quilt old/source/interpret.c new/source/interpret.c mem = (SparseArrayEntryWrapper *)XtMalloc(sizeof(SparseArrayEntryWrapper)); - mem->next = (struct SparseArrayEntryWrapper *)AllocatedSparseArrayEntries; -+ mem->next = (SparseArrayEntryWrapper *)AllocatedSparseArrayEntries; ++ mem->next = AllocatedSparseArrayEntries; AllocatedSparseArrayEntries = mem; #ifdef TRACK_GARBAGE_LEAKS ++numAllocatedSparseArrayElements; #endif return(&(mem->data)); -@@ -990,11 +990,11 @@ void GarbageCollectStrings(void) +@@ -924,11 +924,11 @@ static void MarkArrayContentsAsUsed(Spar + if (!(*(globalSEUse->value.val.str.rep - 1))) { + *(globalSEUse->value.val.str.rep - 1) = 1; + } + } + else if (globalSEUse->value.tag == ARRAY_TAG) { +- MarkArrayContentsAsUsed((SparseArrayEntry *)globalSEUse->value.val.arrayPtr); ++ MarkArrayContentsAsUsed(globalSEUse->value.val.arrayPtr); + } + } + } + } + +@@ -948,11 +948,11 @@ void GarbageCollectStrings(void) + for (p = AllocatedStrings; p != NULL; p = *((char **)p)) { + *(p + sizeof(char *)) = 0; + } + + for (thisAP = AllocatedSparseArrayEntries; +- thisAP != NULL; thisAP = (SparseArrayEntryWrapper *)thisAP->next) { ++ thisAP != NULL; thisAP = thisAP->next) { + thisAP->inUse = 0; + } + + /* Sweep the global symbol list, marking which strings are still + referenced */ +@@ -962,11 +962,11 @@ void GarbageCollectStrings(void) + if (!(*(s->value.val.str.rep - 1))) { + *(s->value.val.str.rep - 1) = 1; + } + } + else if (s->value.tag == ARRAY_TAG) { +- MarkArrayContentsAsUsed((SparseArrayEntry *)s->value.val.arrayPtr); ++ MarkArrayContentsAsUsed(s->value.val.arrayPtr); + } + } + + /* Collect all of the strings which remain unreferenced */ + next = AllocatedStrings; +@@ -988,20 +988,20 @@ void GarbageCollectStrings(void) + + nextAP = AllocatedSparseArrayEntries; AllocatedSparseArrayEntries = NULL; while (nextAP != NULL) { thisAP = nextAP; - nextAP = (SparseArrayEntryWrapper *)nextAP->next; +- nextAP = (SparseArrayEntryWrapper *)nextAP->next; ++ nextAP = nextAP->next; if (thisAP->inUse != 0) { - thisAP->next = (struct SparseArrayEntryWrapper *)AllocatedSparseArrayEntries; -+ thisAP->next = (SparseArrayEntryWrapper *)AllocatedSparseArrayEntries; ++ thisAP->next = AllocatedSparseArrayEntries; AllocatedSparseArrayEntries = thisAP; } else { #ifdef TRACK_GARBAGE_LEAKS --numAllocatedSparseArrayElements; + #endif +- XtFree((void *)thisAP); ++ XtFree((char *)thisAP); + } + } + + #ifdef TRACK_GARBAGE_LEAKS + printf("str count = %d\nary count = %d\n", numAllocatedStrings, numAllocatedSparseArrayElements); @@ -2283,13 +2283,13 @@ static void arrayDisposeNode(rbTreeNode src->right = NULL; src->parent = NULL; @@ -73,20 +123,27 @@ diff --quilt old/source/interpret.c new/source/interpret.c } - iteratorValPtr->val.arrayPtr = (struct SparseArrayEntry *)arrayIterateFirst(&arrayVal); -+ iteratorValPtr->val.arrayPtr = (SparseArrayEntry *)arrayIterateFirst(&arrayVal); ++ iteratorValPtr->val.arrayPtr = 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) +@@ -2672,17 +2672,17 @@ static int arrayIter(void) + } + else { + return(execError("bad temporary iterator: %s", iterator->name)); + } + +- thisEntry = (SparseArrayEntry *)iteratorValPtr->val.arrayPtr; ++ thisEntry = iteratorValPtr->val.arrayPtr; 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); ++ iteratorValPtr->val.arrayPtr = arrayIterateNext(thisEntry); } else { PC = branchAddr; -- 2.11.4.GIT