summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-06-26 07:27:00 +0000
committerAndrew Tridgell <tridge@samba.org>2002-06-26 07:27:00 +0000
commit2842de9d7c9343dcb5d57215afb7316d505148b8 (patch)
tree4d787ebf62cfaeab635ae5c955e38c28502acd1f
parent5d61d02c15a8e9ba09dcbf215fadf074be1f5760 (diff)
downloadsamba-2842de9d7c9343dcb5d57215afb7316d505148b8.tar.gz
samba-2842de9d7c9343dcb5d57215afb7316d505148b8.tar.bz2
samba-2842de9d7c9343dcb5d57215afb7316d505148b8.zip
made the wins list handling a littler clearer
(This used to be commit d03efabc4dca842cafcd0edfa1eaa5b4d3e821b6)
-rw-r--r--source3/lib/wins_srv.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/source3/lib/wins_srv.c b/source3/lib/wins_srv.c
index cad0d06e49..c31e7505f0 100644
--- a/source3/lib/wins_srv.c
+++ b/source3/lib/wins_srv.c
@@ -85,10 +85,7 @@ unsigned long wins_srv_count(void)
int count = 0;
list = lp_wins_server_list();
- while (list && *list) {
- count++;
- list++;
- }
+ for (count=0; list && list[count]; count++) /* nop */ ;
DEBUG(6,("Found %u wins servers in list\n", count));
return count;
@@ -101,25 +98,24 @@ struct in_addr wins_srv_ip(void)
{
char **list;
struct in_addr ip;
+ int i;
list = lp_wins_server_list();
- if (!list || !*list) {
+ if (!list || !list[0]) {
zero_ip(&ip);
return ip;
}
/* find the first live one */
- while (list && *list) {
- ip = *interpret_addr2(*list);
+ for (i=0; list[i]; i++) {
+ ip = *interpret_addr2(list[i]);
if (!wins_is_dead(ip)) {
DEBUG(6,("Current wins server is %s\n", inet_ntoa(ip)));
return ip;
}
- list++;
}
/* damn, they are all dead. Keep trying the primary until they revive */
- list = lp_wins_server_list();
ip = *interpret_addr2(list[0]);
return ip;