summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-02-13 14:01:14 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-02-13 14:58:04 +0100
commit3217c7eef266b2a99d67545abf8eb443d6124e07 (patch)
tree8bc097bb26f1f46ee909d851aaca8de1e06e5d87
parentbe6e6984b5a6d8f2543cde1f1ed0c7c3b175d88c (diff)
downloadc-ares-3217c7eef266b2a99d67545abf8eb443d6124e07.tar.gz
c-ares-3217c7eef266b2a99d67545abf8eb443d6124e07.tar.bz2
c-ares-3217c7eef266b2a99d67545abf8eb443d6124e07.zip
ares__swap_lists: make private and static
... since there's only one user, make it static within ares_process.c
-rw-r--r--ares_llist.c23
-rw-r--r--ares_llist.h3
-rw-r--r--ares_process.c29
3 files changed, 27 insertions, 28 deletions
diff --git a/ares_llist.c b/ares_llist.c
index c0acd90..36ca84c 100644
--- a/ares_llist.c
+++ b/ares_llist.c
@@ -61,26 +61,3 @@ void ares__remove_from_list(struct list_node* node) {
}
}
-/* Swap the contents of two lists */
-void ares__swap_lists(struct list_node* head_a,
- struct list_node* head_b) {
- int is_a_empty = ares__is_list_empty(head_a);
- int is_b_empty = ares__is_list_empty(head_b);
- struct list_node old_a = *head_a;
- struct list_node old_b = *head_b;
-
- if (is_a_empty) {
- ares__init_list_head(head_b);
- } else {
- *head_b = old_a;
- old_a.next->prev = head_b;
- old_a.prev->next = head_b;
- }
- if (is_b_empty) {
- ares__init_list_head(head_a);
- } else {
- *head_a = old_b;
- old_b.next->prev = head_a;
- old_b.prev->next = head_a;
- }
-}
diff --git a/ares_llist.h b/ares_llist.h
index b09f0de..20f4d1c 100644
--- a/ares_llist.h
+++ b/ares_llist.h
@@ -36,7 +36,4 @@ void ares__insert_in_list(struct list_node* new_node,
void ares__remove_from_list(struct list_node* node);
-void ares__swap_lists(struct list_node* head_a,
- struct list_node* head_b);
-
#endif /* __ARES_LLIST_H */
diff --git a/ares_process.c b/ares_process.c
index 2a02f16..bbeca5e 100644
--- a/ares_process.c
+++ b/ares_process.c
@@ -1,6 +1,6 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2004-2012 by Daniel Stenberg
+ * Copyright (C) 2004-2013 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -640,6 +640,31 @@ static void process_broken_connections(ares_channel channel,
}
}
+/* Swap the contents of two lists */
+static void swap_lists(struct list_node* head_a,
+ struct list_node* head_b)
+{
+ int is_a_empty = ares__is_list_empty(head_a);
+ int is_b_empty = ares__is_list_empty(head_b);
+ struct list_node old_a = *head_a;
+ struct list_node old_b = *head_b;
+
+ if (is_a_empty) {
+ ares__init_list_head(head_b);
+ } else {
+ *head_b = old_a;
+ old_a.next->prev = head_b;
+ old_a.prev->next = head_b;
+ }
+ if (is_b_empty) {
+ ares__init_list_head(head_a);
+ } else {
+ *head_a = old_b;
+ old_b.next->prev = head_a;
+ old_b.prev->next = head_a;
+ }
+}
+
static void handle_error(ares_channel channel, int whichserver,
struct timeval *now)
{
@@ -660,7 +685,7 @@ static void handle_error(ares_channel channel, int whichserver,
* same server->queries_to_server list.
*/
ares__init_list_head(&list_head);
- ares__swap_lists(&list_head, &(server->queries_to_server));
+ swap_lists(&list_head, &(server->queries_to_server));
for (list_node = list_head.next; list_node != &list_head; )
{
query = list_node->data;