[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] The function list operation of "_evdns_nameserver_add_impl"




Dear,

I do not understand of the list operation of the _evdns_nameserver_add_impl.

How to understand this snippet?

Best is figures and notes.



Thank you very much!


       /* insert this nameserver into the list of them */
       if (!server_head) {
               ns->next = ns->prev = ns;
               server_head = ns;
       } else {
               ns->next = server_head->next;
               ns->prev = server_head;
               server_head->next = ns;
               if (server_head->prev == server_head) {
                       server_head->prev = ns;
               }
       }