Skip to content

Commit 7e75b0c

Browse files
authored
Merge pull request #629 from Komzpa/darafei/ai-idn-netdb-guard
net: simplify AI_IDN guards
2 parents ca2d9a2 + 931cbde commit 7e75b0c

6 files changed

Lines changed: 11 additions & 10 deletions

File tree

configure.ac

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ AC_CHECK_HEADERS([ \
5252
linux/errqueue.h \
5353
ncurses.h \
5454
ncurses/curses.h \
55+
netdb.h \
5556
netinet/in.h \
5657
socket.h \
5758
sys/cdefs.h \
@@ -211,14 +212,6 @@ AC_CHECK_DECLS([errno], [], [], [[
211212
#include <errno.h>
212213
#include <sys/errno.h>
213214
]])
214-
AC_CHECK_DECLS([AI_IDN], [], [], [[
215-
#include <sys/types.h>
216-
#ifdef HAVE_SYS_SOCKET_H
217-
#include <sys/socket.h>
218-
#endif
219-
#include <netdb.h>
220-
]])
221-
222215
AC_CHECK_TYPE([socklen_t],
223216
[AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t])], [],
224217
[[#include <netinet/in.h>

ui/asn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
4040
#include <arpa/nameser_compat.h>
4141
#endif
42+
#ifdef HAVE_NETDB_H
4243
#include <netdb.h>
44+
#endif
4345
#include <netinet/in.h>
4446
#include <resolv.h>
4547
#include <string.h>

ui/mtr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ int get_addrinfo_from_name(
851851
memset(&hints, 0, sizeof hints);
852852
hints.ai_family = ctl->af;
853853
hints.ai_socktype = SOCK_DGRAM;
854-
#if HAVE_DECL_AI_IDN
854+
#ifdef AI_IDN
855855
hints.ai_flags = AI_IDN;
856856
#endif
857857
gai_error = getaddrinfo(name, NULL, &hints, res);
@@ -898,7 +898,7 @@ static int validate_report_targets(
898898
memset(&hints, 0, sizeof hints);
899899
hints.ai_family = lookup_ctl.af;
900900
hints.ai_socktype = SOCK_DGRAM;
901-
#if HAVE_DECL_AI_IDN
901+
#ifdef AI_IDN
902902
hints.ai_flags = AI_IDN;
903903
#endif
904904
gai_error = getaddrinfo(names->name, NULL, &hints, &res);

ui/mtr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include "config.h"
2424

2525
#include <stdint.h>
26+
#ifdef HAVE_NETDB_H
2627
#include <netdb.h>
28+
#endif
2729
#include <sys/socket.h>
2830
#include <arpa/inet.h>
2931

ui/net.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
/* Prototypes for functions in net.c */
2020
#include <sys/types.h>
21+
#ifdef HAVE_NETDB_H
2122
#include <netdb.h>
23+
#endif
2224
#include <arpa/inet.h>
2325
#include <netinet/in.h>
2426
#include <sys/socket.h>

ui/report.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
#include <sys/types.h>
2222
#include <stdio.h>
23+
#ifdef HAVE_NETDB_H
2324
#include <netdb.h>
25+
#endif
2426
#include <netinet/in.h>
2527
#include <sys/socket.h>
2628
#include <string.h>

0 commit comments

Comments
 (0)