diff options
| author | Lars Ingebrigtsen | 2016-01-30 01:28:34 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-01-30 01:28:34 +0100 |
| commit | 4876011820930e3f63c5129c432927a4b4600fab (patch) | |
| tree | 57bcb3dc82512890aa7b9f880c429564b727a4ec /src | |
| parent | fdfb68690f75a77a32d286e17a39e2543e07e58c (diff) | |
| download | emacs-4876011820930e3f63c5129c432927a4b4600fab.tar.gz emacs-4876011820930e3f63c5129c432927a4b4600fab.zip | |
Clean up GETADDRINFO usage in make-network-process
* process.c (Fmake_network_process): Clean up the GETADDRINFO
handling.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/process.c b/src/process.c index 4f0c4e9bcdc..88441c91de6 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3471,12 +3471,11 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3471 | Lisp_Object proc; | 3471 | Lisp_Object proc; |
| 3472 | Lisp_Object contact; | 3472 | Lisp_Object contact; |
| 3473 | struct Lisp_Process *p; | 3473 | struct Lisp_Process *p; |
| 3474 | #ifdef HAVE_GETADDRINFO | 3474 | #if defined(HAVE_GETADDRINFO) || defined(HAVE_GETADDRINFO_A) |
| 3475 | struct addrinfo ai, *res, *lres; | ||
| 3476 | struct addrinfo *hints; | 3475 | struct addrinfo *hints; |
| 3477 | const char *portstring; | 3476 | const char *portstring; |
| 3478 | char portbuf[128]; | 3477 | char portbuf[128]; |
| 3479 | #endif /* HAVE_GETADDRINFO */ | 3478 | #endif |
| 3480 | #ifdef HAVE_LOCAL_SOCKETS | 3479 | #ifdef HAVE_LOCAL_SOCKETS |
| 3481 | struct sockaddr_un address_un; | 3480 | struct sockaddr_un address_un; |
| 3482 | #endif | 3481 | #endif |
| @@ -3527,12 +3526,6 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3527 | 3526 | ||
| 3528 | CHECK_STRING (name); | 3527 | CHECK_STRING (name); |
| 3529 | 3528 | ||
| 3530 | /* Initialize addrinfo structure in case we don't use getaddrinfo. */ | ||
| 3531 | ai.ai_socktype = socktype; | ||
| 3532 | ai.ai_protocol = 0; | ||
| 3533 | ai.ai_next = NULL; | ||
| 3534 | res = &ai; | ||
| 3535 | |||
| 3536 | /* :local ADDRESS or :remote ADDRESS */ | 3529 | /* :local ADDRESS or :remote ADDRESS */ |
| 3537 | tem = Fplist_get (contact, QCserver); | 3530 | tem = Fplist_get (contact, QCserver); |
| 3538 | if (!NILP (tem)) | 3531 | if (!NILP (tem)) |
| @@ -3652,6 +3645,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3652 | { | 3645 | { |
| 3653 | struct gaicb **reqs = xmalloc (sizeof (struct gaicb*)); | 3646 | struct gaicb **reqs = xmalloc (sizeof (struct gaicb*)); |
| 3654 | 3647 | ||
| 3648 | printf("Async DNS for '%s'\n", SSDATA (host)); | ||
| 3655 | dns_request = xmalloc (sizeof (struct gaicb)); | 3649 | dns_request = xmalloc (sizeof (struct gaicb)); |
| 3656 | reqs[0] = dns_request; | 3650 | reqs[0] = dns_request; |
| 3657 | dns_request->ar_name = strdup (SSDATA (host)); | 3651 | dns_request->ar_name = strdup (SSDATA (host)); |
| @@ -3673,6 +3667,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3673 | 3667 | ||
| 3674 | if (!NILP (host)) | 3668 | if (!NILP (host)) |
| 3675 | { | 3669 | { |
| 3670 | struct addrinfo *res, *lres; | ||
| 3671 | |||
| 3676 | immediate_quit = 1; | 3672 | immediate_quit = 1; |
| 3677 | QUIT; | 3673 | QUIT; |
| 3678 | 3674 | ||
| @@ -3699,6 +3695,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3699 | } | 3695 | } |
| 3700 | 3696 | ||
| 3701 | ip_addresses = Fnreverse (ip_addresses); | 3697 | ip_addresses = Fnreverse (ip_addresses); |
| 3698 | |||
| 3699 | freeaddrinfo (res); | ||
| 3702 | xfree (hints); | 3700 | xfree (hints); |
| 3703 | 3701 | ||
| 3704 | goto open_socket; | 3702 | goto open_socket; |