summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-12-03 05:54:51 +0000
committerAndrew Tridgell <tridge@samba.org>1997-12-03 05:54:51 +0000
commitd3046caa5c2922552cb34ed4f5203f962cef4eb2 (patch)
treef54264a4c7736b2f144c02481cc35c3ee409c664 /source3
parente94d5632392bb98d026ef2076702ef7b0870aea5 (diff)
downloadsamba-d3046caa5c2922552cb34ed4f5203f962cef4eb2.tar.gz
samba-d3046caa5c2922552cb34ed4f5203f962cef4eb2.tar.bz2
samba-d3046caa5c2922552cb34ed4f5203f962cef4eb2.zip
slight cleanup to the linked list handling
(This used to be commit 97b62b347648411d034ab91845ae607eca4dfad6)
Diffstat (limited to 'source3')
-rw-r--r--source3/namebrowse.c23
-rw-r--r--source3/namedbserver.c26
2 files changed, 20 insertions, 29 deletions
diff --git a/source3/namebrowse.c b/source3/namebrowse.c
index c0deaff0fa..2f883d4450 100644
--- a/source3/namebrowse.c
+++ b/source3/namebrowse.c
@@ -72,22 +72,17 @@ void expire_browse_cache(time_t t)
/* expire old entries in the serverlist */
for (b = browserlist; b; b = nextb)
{
- if (b->synced && b->sync_time < t)
- {
- DEBUG(3,("Removing dead cached browser %s\n",b->name));
- nextb = b->next;
+ nextb = b->next;
+ if (b->synced && b->sync_time < t) {
+ DEBUG(3,("Removing dead cached browser %s\n",b->name));
- if (b->prev) b->prev->next = b->next;
- if (b->next) b->next->prev = b->prev;
+ if (b->prev) b->prev->next = b->next;
+ if (b->next) b->next->prev = b->prev;
- if (browserlist == b) browserlist = b->next;
-
- free(b);
- }
- else
- {
- nextb = b->next;
- }
+ if (browserlist == b) browserlist = b->next;
+
+ free(b);
+ }
}
}
diff --git a/source3/namedbserver.c b/source3/namedbserver.c
index 7440b42494..c3f6076f49 100644
--- a/source3/namedbserver.c
+++ b/source3/namedbserver.c
@@ -58,24 +58,20 @@ void remove_old_servers(struct work_record *work, time_t t,
/* expire old entries in the serverlist */
for (s = work->serverlist; s; s = nexts)
{
- if (remove_all || (s->death_time && (t == -1 || s->death_time < t)))
- {
- DEBUG(3,("Removing dead server %s\n",s->serv.name));
- updatedlists = True;
- nexts = s->next;
+ nexts = s->next;
+ if (remove_all ||
+ (s->death_time && (t == -1 || s->death_time < t))) {
+ DEBUG(3,("Removing dead server %s\n",s->serv.name));
+ updatedlists = True;
- if (s->prev) s->prev->next = s->next;
- if (s->next) s->next->prev = s->prev;
+ if (s->prev) s->prev->next = s->next;
+ if (s->next) s->next->prev = s->prev;
- if (work->serverlist == s)
- work->serverlist = s->next;
+ if (work->serverlist == s)
+ work->serverlist = s->next;
- free(s);
- }
- else
- {
- nexts = s->next;
- }
+ free(s);
+ }
}
}