From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 20 13:30:10 2015 Return-Path: Delivered-To: svn-src-stable-8@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CA5A7E6; Sat, 20 Jun 2015 13:30:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89FABB55; Sat, 20 Jun 2015 13:30:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5KDUAe2044194; Sat, 20 Jun 2015 13:30:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5KDUASG044193; Sat, 20 Jun 2015 13:30:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201506201330.t5KDUASG044193@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 20 Jun 2015 13:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r284643 - in stable: 10/lib/libfetch 7/lib/libfetch 8/lib/libfetch 9/lib/libfetch X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 13:30:10 -0000 Author: dim Date: Sat Jun 20 13:30:09 2015 New Revision: 284643 URL: https://svnweb.freebsd.org/changeset/base/284643 Log: MFC r284346: Fix the following clang 3.7.0 warnings in lib/libfetch/http.c: lib/libfetch/http.c:1628:26: error: address of array 'purl->user' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.user = purl->user ? ~~~~~~^~~~ ~ lib/libfetch/http.c:1630:30: error: address of array 'purl->pwd' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.password = purl->pwd? ~~~~~~^~~~ lib/libfetch/http.c:1657:25: error: address of array 'url->user' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.user = url->user ? ~~~~~^~~~ ~ lib/libfetch/http.c:1659:29: error: address of array 'url->pwd' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.password = url->pwd ? ~~~~~^~~ ~ lib/libfetch/http.c:1669:25: error: address of array 'url->user' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.user = url->user ? ~~~~~^~~~ ~ lib/libfetch/http.c:1671:29: error: address of array 'url->pwd' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.password = url->pwd ? ~~~~~^~~ ~ Since url->user and url->pwd are arrays, they can never be NULL, so the checks can be removed. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D2673 Modified: stable/8/lib/libfetch/http.c Directory Properties: stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/libfetch/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libfetch/http.c stable/7/lib/libfetch/http.c stable/9/lib/libfetch/http.c Directory Properties: stable/10/ (props changed) stable/7/ (props changed) stable/7/lib/ (props changed) stable/7/lib/libfetch/ (props changed) stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/libfetch/ (props changed) Modified: stable/8/lib/libfetch/http.c ============================================================================== --- stable/8/lib/libfetch/http.c Sat Jun 20 13:25:28 2015 (r284642) +++ stable/8/lib/libfetch/http.c Sat Jun 20 13:30:09 2015 (r284643) @@ -1615,10 +1615,8 @@ http_request(struct url *URL, const char http_auth_params_t aparams; init_http_auth_params(&aparams); if (*purl->user || *purl->pwd) { - aparams.user = purl->user ? - strdup(purl->user) : strdup(""); - aparams.password = purl->pwd? - strdup(purl->pwd) : strdup(""); + aparams.user = strdup(purl->user); + aparams.password = strdup(purl->pwd); } else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { @@ -1644,10 +1642,8 @@ http_request(struct url *URL, const char http_auth_params_t aparams; init_http_auth_params(&aparams); if (*url->user || *url->pwd) { - aparams.user = url->user ? - strdup(url->user) : strdup(""); - aparams.password = url->pwd ? - strdup(url->pwd) : strdup(""); + aparams.user = strdup(url->user); + aparams.password = strdup(url->pwd); } else if ((p = getenv("HTTP_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { @@ -1656,10 +1652,8 @@ http_request(struct url *URL, const char } } else if (fetchAuthMethod && fetchAuthMethod(url) == 0) { - aparams.user = url->user ? - strdup(url->user) : strdup(""); - aparams.password = url->pwd ? - strdup(url->pwd) : strdup(""); + aparams.user = strdup(url->user); + aparams.password = strdup(url->pwd); } else { http_seterr(HTTP_NEED_AUTH); goto ouch;