diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-02-06 12:38:24 +1100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-02-10 15:36:37 -0800 |
commit | ece7089918e37f407f84d13df9d816d5a6d90f2e (patch) | |
tree | 3c6919817b656fa3a0f9a99063e14fbb9d55d7b8 /source3/nmbd | |
parent | a5d2fb752cdb7e27a4949635b6486834d9fac313 (diff) | |
download | samba-ece7089918e37f407f84d13df9d816d5a6d90f2e.tar.gz samba-ece7089918e37f407f84d13df9d816d5a6d90f2e.tar.bz2 samba-ece7089918e37f407f84d13df9d816d5a6d90f2e.zip |
s3-nmbd: update nmbd to use new DLIST_ macros
(cherry picked from commit 4d23d777bc6d4fad20d0f3084fe658635812bee9)
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/asyncdns.c | 18 | ||||
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 20 | ||||
-rw-r--r-- | source3/nmbd/nmbd_serverlistdb.c | 35 | ||||
-rw-r--r-- | source3/nmbd/nmbd_workgroupdb.c | 9 |
4 files changed, 9 insertions, 73 deletions
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c index 85729ae7ac..8b49f510a1 100644 --- a/source3/nmbd/asyncdns.c +++ b/source3/nmbd/asyncdns.c @@ -258,13 +258,8 @@ void run_dns_queue(void) in_dns = 0; p->locked = False; - if (p->prev) - p->prev->next = p->next; - else - dns_queue = p->next; - if (p->next) - p->next->prev = p->prev; p2 = p->next; + DLIST_REMOVE(dns_queue, p); free_packet(p); p = p2; } else { @@ -274,10 +269,7 @@ void run_dns_queue(void) if (dns_queue) { dns_current = dns_queue; - dns_queue = dns_queue->next; - if (dns_queue) - dns_queue->prev = NULL; - dns_current->next = NULL; + DLIST_REMOVE(dns_queue, dns_queue); if (!write_child(dns_current)) { DEBUG(3,("failed to send DNS query to child!\n")); @@ -304,11 +296,7 @@ bool queue_dns_query(struct packet_struct *p,struct nmb_name *question) p->locked = True; } else { p->locked = True; - p->next = dns_queue; - p->prev = NULL; - if (p->next) - p->next->prev = p; - dns_queue = p; + DLIST_ADD(dns_queue, p); } DEBUG(3,("added DNS query for %s\n", nmb_namestr(question))); diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index a753b2841d..7a6250c2f1 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1013,20 +1013,7 @@ void queue_packet(struct packet_struct *packet) { struct packet_struct *p; - if (!packet_queue) { - packet->prev = NULL; - packet->next = NULL; - packet_queue = packet; - return; - } - - /* find the bottom */ - for (p=packet_queue;p->next;p=p->next) - ; - - p->next = packet; - packet->next = NULL; - packet->prev = p; + DLIST_ADD_END(packet_queue, packet, struct packet_struct *); } /**************************************************************************** @@ -1582,10 +1569,7 @@ void run_packet_queue(void) struct packet_struct *p; while ((p = packet_queue)) { - packet_queue = p->next; - if (packet_queue) - packet_queue->prev = NULL; - p->next = p->prev = NULL; + DLIST_REMOVE(packet_queue, p); switch (p->packet_type) { case NMB_PACKET: diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c index 0728f29c32..f3fba51f4a 100644 --- a/source3/nmbd/nmbd_serverlistdb.c +++ b/source3/nmbd/nmbd_serverlistdb.c @@ -36,15 +36,7 @@ void remove_all_servers(struct work_record *work) for (servrec = work->serverlist; servrec; servrec = nexts) { DEBUG(7,("remove_all_servers: Removing server %s\n",servrec->serv.name)); nexts = servrec->next; - - if (servrec->prev) - servrec->prev->next = servrec->next; - if (servrec->next) - servrec->next->prev = servrec->prev; - - if (work->serverlist == servrec) - work->serverlist = servrec->next; - + DLIST_REMOVE(work->serverlist, servrec); ZERO_STRUCTP(servrec); SAFE_FREE(servrec); } @@ -59,21 +51,7 @@ void remove_all_servers(struct work_record *work) static void add_server_to_workgroup(struct work_record *work, struct server_record *servrec) { - struct server_record *servrec2; - - if (!work->serverlist) { - work->serverlist = servrec; - servrec->prev = NULL; - servrec->next = NULL; - return; - } - - for (servrec2 = work->serverlist; servrec2->next; servrec2 = servrec2->next) - ; - - servrec2->next = servrec; - servrec->next = NULL; - servrec->prev = servrec2; + DLIST_ADD_END(work->serverlist, servrec, struct server_record *); work->subnet->work_changed = True; } @@ -99,14 +77,7 @@ struct server_record *find_server_in_workgroup(struct work_record *work, const c void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec) { - if (servrec->prev) - servrec->prev->next = servrec->next; - if (servrec->next) - servrec->next->prev = servrec->prev; - - if (work->serverlist == servrec) - work->serverlist = servrec->next; - + DLIST_REMOVE(work->serverlist, servrec); ZERO_STRUCTP(servrec); SAFE_FREE(servrec); work->subnet->work_changed = True; diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c index 1845401d9e..55a86c0889 100644 --- a/source3/nmbd/nmbd_workgroupdb.c +++ b/source3/nmbd/nmbd_workgroupdb.c @@ -139,14 +139,7 @@ static struct work_record *remove_workgroup_from_subnet(struct subnet_record *su remove_all_servers(work); if (!work->serverlist) { - if (work->prev) - work->prev->next = work->next; - if (work->next) - work->next->prev = work->prev; - - if (subrec->workgrouplist == work) - subrec->workgrouplist = work->next; - + DLIST_REMOVE(subrec->workgrouplist, work); ZERO_STRUCTP(work); SAFE_FREE(work); } |