From patchwork Mon Oct 20 22:35:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 401279 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 7693714003E for ; Tue, 21 Oct 2014 09:35:42 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; q= dns; s=default; b=EayXH1u8228+Q8rbpTcA9Luco93cvlS1Y7TSlmhQ4MplQY IzjceldbSqku1RrYU8QSgv6OtadLYIjDGaRw/LDN5AUEcu0Yq0pInfpSgSp2IeBO oDPWNn4LK9cPTaSWHG8+goiNEHNhGBrQqNK+UCCJOHlKSUqo49fkQaEuq64NM= 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:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; s= default; bh=rFazuk/T/uT9x+7P58/pyP0AczE=; b=C5KWe1hreWxnB1i7rswD hy+YozsdhrlOvNc2UGXCC96M7dtlLHLWrFudQjiYqEMr3EYPlyEoxV3TTE4NNxi1 zUJyiUTiSgpxmZUH0GM6ZJthUDxG+x2CPg2i5oUylEemvWeP12W30kCtGqh29IaR KtF0j4IUxLFmMCbUjy+TB28= Received: (qmail 19168 invoked by alias); 20 Oct 2014 22:35:37 -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 19157 invoked by uid 89); 20 Oct 2014 22:35:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] Tiny refactoring in fts to eliminate a warning. Message-Id: <20141020223533.339C92C3B04@topped-with-meat.com> Date: Mon, 20 Oct 2014 15:35:33 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=79GyIy8Dc_BZJfq9pEkA:9 a=CjuIK1q_8ugA:10 There was a "set but not used" warning for NOSTAT in configurations without _DIRENT_HAVE_D_TYPE. This fixes it. It does not change generated code. Thanks, Roland * io/fts.c (dirent_not_directory): New function. (fts_build): Call it. 2014-10-20 Roland McGrath --- a/io/fts.c +++ b/io/fts.c @@ -561,6 +561,16 @@ fts_children(sp, instr) return (sp->fts_child); } +static inline int +dirent_not_directory(const struct dirent *dp) +{ +#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE + return dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN; +#else + return 0; +#endif +} + /* * This is the tricky part -- do not casually change *anything* in here. The * idea is to build the linked list of entries that are used by fts_children @@ -759,11 +769,7 @@ mem1: saved_errno = errno; p->fts_info = FTS_NSOK; p->fts_accpath = cur->fts_accpath; } else if (nlinks == 0 -#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE - || (nostat && - dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) -#endif - ) { + || (nostat && dirent_not_directory(dp))) { p->fts_accpath = ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name; p->fts_info = FTS_NSOK;