mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-08-15 11:27:35 +00:00
- moved protocol removal to a proper function and fixed it
This commit is contained in:
@@ -84,6 +84,22 @@ static NetProtocol *find_protocol(uint16 type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove all protocols
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void remove_all_protocols(void)
|
||||||
|
{
|
||||||
|
NetProtocol *p = prot_list;
|
||||||
|
while (p) {
|
||||||
|
NetProtocol *next = p->next;
|
||||||
|
delete p;
|
||||||
|
p = next;
|
||||||
|
}
|
||||||
|
prot_list = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialization
|
* Initialization
|
||||||
*/
|
*/
|
||||||
@@ -195,12 +211,7 @@ void EtherExit(void)
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
// Remove all protocols
|
// Remove all protocols
|
||||||
NetProtocol *p = prot_list;
|
remove_all_protocols();
|
||||||
while (p) {
|
|
||||||
NetProtocol *next = p->next;
|
|
||||||
delete p;
|
|
||||||
p = next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -210,13 +221,7 @@ void EtherExit(void)
|
|||||||
|
|
||||||
void EtherReset(void)
|
void EtherReset(void)
|
||||||
{
|
{
|
||||||
// Remove all protocols
|
remove_all_protocols();
|
||||||
NetProtocol *p = prot_list;
|
|
||||||
while (p) {
|
|
||||||
NetProtocol *next = p->next;
|
|
||||||
delete p;
|
|
||||||
p = next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -283,7 +288,7 @@ int16 ether_detach_ph(uint16 type)
|
|||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
NetProtocol *q = prot_list;
|
NetProtocol *q = prot_list;
|
||||||
if (p == q) {
|
if (p == q) {
|
||||||
prot_list = NULL;
|
prot_list = p->next;
|
||||||
delete p;
|
delete p;
|
||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user