ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/evdns.c
(Generate patch)

Comparing libev/evdns.c (file contents):
Revision 1.4 by root, Thu Nov 1 17:45:30 2007 UTC vs.
Revision 1.16 by root, Tue Nov 6 16:09:37 2007 UTC

1#define DNS_USE_GETTIMEOFDAY_FOR_ID 1 1/* $Id: evdns.c,v 1.16 2007/11/06 16:09:37 root Exp $ */
2#define HAVE_STRUCT_IN6_ADDR 1
3 2
4/* The original version of this module was written by Adam Langley; for 3/* The original version of this module was written by Adam Langley; for
5 * a history of modifications, check out the subversion logs. 4 * a history of modifications, check out the subversion logs.
6 * 5 *
7 * When editing this module, try to keep it re-mergeable by Adam. Don't 6 * When editing this module, try to keep it re-mergeable by Adam. Don't
39#ifdef HAVE_CONFIG_H 38#ifdef HAVE_CONFIG_H
40#include "config.h" 39#include "config.h"
41#endif 40#endif
42 41
43#ifdef WIN32 42#ifdef WIN32
43#ifndef EV_STANDALONE
44#include "misc.h" 44#include "misc.h"
45#endif
45#endif 46#endif
46 47
47/* #define NDEBUG */ 48/* #define NDEBUG */
48 49
49#ifndef DNS_USE_CPU_CLOCK_FOR_ID 50#ifndef DNS_USE_CPU_CLOCK_FOR_ID
77 78
78#define _FORTIFY_SOURCE 3 79#define _FORTIFY_SOURCE 3
79 80
80#include <string.h> 81#include <string.h>
81#include <fcntl.h> 82#include <fcntl.h>
82#include <sys/time.h>
83#ifdef HAVE_STDINT_H 83#ifdef HAVE_STDINT_H
84#include <stdint.h> 84#include <stdint.h>
85#endif 85#endif
86#include <stdlib.h> 86#include <stdlib.h>
87#include <string.h> 87#include <string.h>
88#include <errno.h> 88#include <errno.h>
89#include <assert.h> 89#include <assert.h>
90#include <unistd.h>
91#include <limits.h> 90#include <limits.h>
92#include <sys/stat.h> 91#include <sys/stat.h>
93#include <ctype.h> 92#include <ctype.h>
94#include <stdio.h> 93#include <stdio.h>
95#include <stdarg.h> 94#include <stdarg.h>
2545 if (flags & DNS_OPTION_NAMESERVERS) evdns_nameserver_ip_add("127.0.0.1"); 2544 if (flags & DNS_OPTION_NAMESERVERS) evdns_nameserver_ip_add("127.0.0.1");
2546} 2545}
2547 2546
2548#ifndef HAVE_STRTOK_R 2547#ifndef HAVE_STRTOK_R
2549static char * 2548static char *
2550fake_strtok_r(char *s, const char *delim, char **state) { 2549strtok_r(char *s, const char *delim, char **state) {
2551 return strtok(s, delim); 2550 return strtok(s, delim);
2552} 2551}
2553#endif 2552#endif
2554 2553
2555/* helper version of atoi which returns -1 on error */ 2554/* helper version of atoi which returns -1 on error */
2621 2620
2622static void 2621static void
2623resolv_conf_parse_line(char *const start, int flags) { 2622resolv_conf_parse_line(char *const start, int flags) {
2624 char *strtok_state; 2623 char *strtok_state;
2625 static const char *const delims = " \t"; 2624 static const char *const delims = " \t";
2626#define NEXT_TOKEN fake_strtok_r(NULL, delims, &strtok_state) 2625#define NEXT_TOKEN strtok_r(NULL, delims, &strtok_state)
2627 2626
2628 char *const first_token = fake_strtok_r(start, delims, &strtok_state); 2627 char *const first_token = strtok_r(start, delims, &strtok_state);
2629 if (!first_token) return; 2628 if (!first_token) return;
2630 2629
2631 if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) { 2630 if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) {
2632 const char *const nameserver = NEXT_TOKEN; 2631 const char *const nameserver = NEXT_TOKEN;
2633 struct in_addr ina; 2632 struct in_addr ina;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines