- moved protocol removal to a proper function and fixed it

This commit is contained in:
cebix
1999-10-03 21:04:29 +00:00
parent f087a2d3bc
commit 67017a2b2c

View File

@@ -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;
} }