From patchwork Thu Apr 28 12:08:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 616158 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qwbGq4F4Qz9t79 for ; Thu, 28 Apr 2016 22:09:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=inrRib5D; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= CNwOoHToMSFDxHwqgqkrDv+01P+S4Rf6ZR76Y9oc8zs+M2DERo53Bw3422997tx9 zjnabJwu7RMC7QOwHMI94UlvQcLVN1KFIiDD2ZcJ26eZ8uQ5gGX9hVmB7xgeURMa rXHQ88sVxFIYt1IJQI/ttsAxY+gIGRiudUQ3xU+s2ns= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=ukZYct 3Dgz6C9sxaSegkVzCaLfc=; b=inrRib5DmhIqWs/KX7Mi4/AujgFk6UZrvXckQE TIDw5UOIyZ/F0I4mnzwb/zWORGzugQ/BC9j5kJjxQ24GE65jFFlLjM876CuoJzg8 GEc9ddRNunxMsc7ThlMoucbLpNp2uktCqgAX8zZvPTem9i6VAljDexkMGcDiVOqW 4YIGA= Received: (qmail 9023 invoked by alias); 28 Apr 2016 12:08:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 8793 invoked by uid 89); 28 Apr 2016 12:08:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=3747, 374, 7, 556, 7, 1079 X-HELO: mx1.redhat.com Date: Thu, 28 Apr 2016 14:08:40 +0200 To: libc-alpha@sourceware.org Subject: [PATCH COMMITTED] resolv: Remove RESOLVSORT preprocess conditionals User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20160428120840.6DFCC403F10AA@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) 2016-04-28 Florian Weimer * resolv/gethnamaddr.c (RESOLVSORT): Do not define. Remove RESOLVSORT preprocessor conditionals. * resolv/nss_dns/dns-host.c: Likewise. * resolv/res_init.c: Likewise. diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c index 2e92df8..2c71313 100644 --- a/resolv/gethnamaddr.c +++ b/resolv/gethnamaddr.c @@ -67,8 +67,6 @@ #include #include -#define RESOLVSORT - #ifndef LOG_AUTH # define LOG_AUTH 0 #endif @@ -107,9 +105,7 @@ static int stayopen = 0; static void map_v4v6_address (const char *src, char *dst) __THROW; static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW; -#ifdef RESOLVSORT extern void addrsort (char **, int) __THROW; -#endif #if PACKETSZ > 65536 #define MAXPACKET PACKETSZ @@ -434,7 +430,6 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype) if (haveanswer) { *ap = NULL; *hap = NULL; -# if defined(RESOLVSORT) /* * Note: we sort even if host can take only one address * in its return structures - should give it the "best" @@ -442,7 +437,6 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype) */ if (_res.nsort && haveanswer > 1 && qtype == T_A) addrsort(h_addr_ptrs, haveanswer); -# endif /*RESOLVSORT*/ if (!host.h_name) { n = strlen(qname) + 1; /* for the \0 */ if (n > buflen || n >= MAXHOSTNAMELEN) @@ -929,7 +923,6 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp) } } -#ifdef RESOLVSORT extern void addrsort (char **ap, int num) { @@ -970,7 +963,6 @@ addrsort (char **ap, int num) needsort++; } } -#endif #if defined(BSD43_BSD43_NFS) || defined(sun) /* some libc's out there are bound internally to these names (UMIPS) */ diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 403a005..93fee10 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -556,7 +556,6 @@ _nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af, errnop, h_errnop, NULL); } -#ifdef RESOLVSORT static void addrsort (char **ap, int num); static void @@ -600,7 +599,6 @@ addrsort (char **ap, int num) else break; } -#endif static enum nss_status getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, @@ -955,7 +953,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, { *ap = NULL; *hap = NULL; -#if defined RESOLVSORT /* * Note: we sort even if host can take only one address * in its return structures - should give it the "best" @@ -963,7 +960,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, */ if (_res.nsort && haveanswer > 1 && qtype == T_A) addrsort (host_data->h_addr_ptrs, haveanswer); -#endif /*RESOLVSORT*/ if (result->h_name == NULL) { diff --git a/resolv/res_init.c b/resolv/res_init.c index de96d84..da1f79e 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -85,18 +85,15 @@ #include /* Options. Should all be left alone. */ -#define RESOLVSORT #define RFC1535 /* #undef DEBUG */ static void res_setoptions (res_state, const char *, const char *) internal_function; -#ifdef RESOLVSORT static const char sort_mask_chars[] = "/&"; #define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL) static u_int32_t net_mask (struct in_addr) __THROW; -#endif #if !defined(isascii) /* XXX - could be a function */ # define isascii(c) (!(c & 0200)) @@ -134,10 +131,8 @@ __res_vinit(res_state statp, int preinit) { int have_serv6 = 0; int haveenv = 0; int havesearch = 0; -#ifdef RESOLVSORT int nsort = 0; char *net; -#endif #ifndef RFC1535 int dots; #endif @@ -328,7 +323,6 @@ __res_vinit(res_state statp, int preinit) { } continue; } -#ifdef RESOLVSORT if (MATCH(buf, "sortlist")) { struct in_addr a; @@ -370,7 +364,6 @@ __res_vinit(res_state statp, int preinit) { } continue; } -#endif if (MATCH(buf, "options")) { res_setoptions(statp, buf + sizeof("options") - 1, "conf"); continue; @@ -381,9 +374,7 @@ __res_vinit(res_state statp, int preinit) { /* We try IPv6 servers again. */ statp->ipv6_unavail = false; } -#ifdef RESOLVSORT statp->nsort = nsort; -#endif (void) fclose(fp); } if (__builtin_expect(statp->nscount == 0, 0)) { @@ -524,7 +515,6 @@ res_setoptions(res_state statp, const char *options, const char *source) { } } -#ifdef RESOLVSORT /* XXX - should really support CIDR which means explicit masks always. */ /* XXX - should really use system's version of this */ static u_int32_t @@ -538,7 +528,6 @@ net_mask (struct in_addr in) return (htonl(IN_CLASSB_NET)); return (htonl(IN_CLASSC_NET)); } -#endif u_int res_randomid(void) {