mirror of https://github.com/macssh/macssh.git
bug fix in createLinkedList
This commit is contained in:
parent
e00cb15e28
commit
3f4faec20c
|
@ -131,29 +131,33 @@ LinkedListNode *createSortedList(ResType ConfigResourceType,short numberofitems,
|
||||||
ResType restype;
|
ResType restype;
|
||||||
LinkedListNode *newNode, *theHead = NULL;
|
LinkedListNode *newNode, *theHead = NULL;
|
||||||
|
|
||||||
if (placeThisFirst != NULL)
|
if (placeThisFirst) {
|
||||||
{
|
|
||||||
theHead = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
|
||||||
ItemResource = Get1NamedResource(ConfigResourceType,placeThisFirst);
|
ItemResource = Get1NamedResource(ConfigResourceType,placeThisFirst);
|
||||||
theHead->name = NewString(placeThisFirst); //set the head of our list
|
if ( ItemResource ) {
|
||||||
theHead->next = NULL;
|
theHead = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
||||||
if (ItemResource != NULL)
|
theHead->name = NewString(placeThisFirst); //set the head of our list
|
||||||
ReleaseResource(ItemResource);
|
theHead->next = NULL;
|
||||||
}
|
|
||||||
for (index = 1; index <= numberofitems; index++)
|
|
||||||
{
|
|
||||||
ItemResource = Get1IndResource(ConfigResourceType, index);
|
|
||||||
GetResInfo(ItemResource, &resID, &restype, (StringPtr)&ItemName);
|
|
||||||
if (!(EqualString(placeThisFirst,ItemName,1,0)))
|
|
||||||
{
|
|
||||||
newNode = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
|
||||||
newNode->name = NewString(ItemName);
|
|
||||||
|
|
||||||
insertInSortedList(&theHead, newNode);
|
|
||||||
ReleaseResource(ItemResource);
|
ReleaseResource(ItemResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (theHead);
|
for (index = 1; index <= numberofitems; index++) {
|
||||||
|
ItemResource = Get1IndResource(ConfigResourceType, index);
|
||||||
|
if ( ItemResource ) {
|
||||||
|
GetResInfo(ItemResource, &resID, &restype, ItemName);
|
||||||
|
if ( !placeThisFirst || !EqualString(placeThisFirst,ItemName,1,0) ) {
|
||||||
|
newNode = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
||||||
|
newNode->name = NewString(ItemName);
|
||||||
|
if ( theHead == NULL ) {
|
||||||
|
theHead = newNode;
|
||||||
|
theHead->next = NULL;
|
||||||
|
} else {
|
||||||
|
insertInSortedList(&theHead, newNode);
|
||||||
|
}
|
||||||
|
ReleaseResource(ItemResource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return theHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedListNode *createSortedList2(ResType ConfigResourceType,short numberofitems,ConstStr255Param placeThisFirst)
|
LinkedListNode *createSortedList2(ResType ConfigResourceType,short numberofitems,ConstStr255Param placeThisFirst)
|
||||||
|
@ -164,29 +168,33 @@ LinkedListNode *createSortedList2(ResType ConfigResourceType,short numberofitems
|
||||||
ResType restype;
|
ResType restype;
|
||||||
LinkedListNode *newNode, *theHead = NULL;
|
LinkedListNode *newNode, *theHead = NULL;
|
||||||
|
|
||||||
if (placeThisFirst != NULL)
|
if (placeThisFirst) {
|
||||||
{
|
|
||||||
theHead = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
|
||||||
ItemResource = GetNamedResource(ConfigResourceType,placeThisFirst);
|
ItemResource = GetNamedResource(ConfigResourceType,placeThisFirst);
|
||||||
theHead->name = NewString(placeThisFirst); //set the head of our list
|
if ( ItemResource ) {
|
||||||
theHead->next = NULL;
|
theHead = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
||||||
if (ItemResource != NULL)
|
theHead->name = NewString(placeThisFirst); //set the head of our list
|
||||||
ReleaseResource(ItemResource);
|
theHead->next = NULL;
|
||||||
}
|
|
||||||
for (index = 1; index <= numberofitems; index++)
|
|
||||||
{
|
|
||||||
ItemResource = GetIndResource(ConfigResourceType, index);
|
|
||||||
GetResInfo(ItemResource, &resID, &restype, (StringPtr)&ItemName);
|
|
||||||
if (!(EqualString(placeThisFirst,ItemName,1,0)))
|
|
||||||
{
|
|
||||||
newNode = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
|
||||||
newNode->name = NewString(ItemName);
|
|
||||||
|
|
||||||
insertInSortedList(&theHead, newNode);
|
|
||||||
ReleaseResource(ItemResource);
|
ReleaseResource(ItemResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (theHead);
|
for (index = 1; index <= numberofitems; index++) {
|
||||||
|
ItemResource = GetIndResource(ConfigResourceType, index);
|
||||||
|
if ( ItemResource ) {
|
||||||
|
GetResInfo(ItemResource, &resID, &restype, (StringPtr)&ItemName);
|
||||||
|
if ( !placeThisFirst || !EqualString(placeThisFirst,ItemName,1,0) ) {
|
||||||
|
newNode = (LinkedListNode *) myNewPtrCritical(sizeof(LinkedListNode));
|
||||||
|
newNode->name = NewString(ItemName);
|
||||||
|
if ( theHead == NULL ) {
|
||||||
|
theHead = newNode;
|
||||||
|
theHead->next = NULL;
|
||||||
|
} else {
|
||||||
|
insertInSortedList(&theHead, newNode);
|
||||||
|
}
|
||||||
|
ReleaseResource(ItemResource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return theHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteItem(LinkedListNode **theHead,Str255 ItemName)
|
void deleteItem(LinkedListNode **theHead,Str255 ItemName)
|
||||||
|
|
Loading…
Reference in New Issue