From owner-svn-src-head@freebsd.org Sun Oct 15 03:54:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03AD3E39299; Sun, 15 Oct 2017 03:54:17 +0000 (UTC) (envelope-from matt.joras@gmail.com) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5FC869848; Sun, 15 Oct 2017 03:54:16 +0000 (UTC) (envelope-from matt.joras@gmail.com) Received: by mail-pf0-f196.google.com with SMTP id d28so13326340pfe.2; Sat, 14 Oct 2017 20:54:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=swni7owpqxRJyyWx+nUxqfyM0Pzi6pJxCYSPr6MFTSY=; b=RjyrfLso4Da+KYEaT8TyLZ8qUOiy64cnFpRwa5Auc728luypnfItyvFRXcn79r5FgG YkpkOyerxCxlPf+dgd0Lu2kg8RmCKSjuuLtUkqlDkq9h2yMyj/vD50XK0HRSCLcB6z/X dDgHND2SJI5JQ7ar6RzmvP4Utpi3eoZxpnY7NCCEQkb7Oji2u1MxnOcCrb3EF00A5SWj /xZjqZB77cBe0u3Y5p+AsRxwi8sEL0nTpvwSgdisxOX5cozIq4Dl/ZVFbLO6SrPzSJot XlNwO9qDsQs+UYUOOMtQxkazq82wotzmM1imRnwkJzOw9YZcPS14Ck9Jub1iQLONcw5d m69A== X-Gm-Message-State: AMCzsaVfknpNNcJB5MJgYHBKyeKJD6VWoAsnXBUkoyvIsrVMTbpDQbpI b1slWJnjdKk8qkFJS+8hT0FUQXRy X-Google-Smtp-Source: AOwi7QBmWwv2BwOwu2V/XNtbL+aXXYJJvQQG4rakjjHIqV39QUJKNYKozbNiumU+kkw7CTw3O0n4Zw== X-Received: by 10.159.197.75 with SMTP id d11mr5030357plo.213.1508025140736; Sat, 14 Oct 2017 16:52:20 -0700 (PDT) Received: from [192.168.2.122] (174-24-242-218.tukw.qwest.net. [174.24.242.218]) by smtp.gmail.com with ESMTPSA id j12sm8709752pfe.160.2017.10.14.16.52.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Oct 2017 16:52:19 -0700 (PDT) Subject: Re: svn commit: r324541 - in head: share/man/man9 sys/kern sys/sys To: Mark Johnston Cc: "Ngie Cooper (yaneurabeya)" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710112153.v9BLroeR007323@repo.freebsd.org> <365AD758-5761-4BD4-A80E-8EF2EA84EAAA@gmail.com> <20171014180305.GA75158@raichu> From: Matt Joras Message-ID: <7fa71bd4-5222-deb3-63f5-828046a4219c@FreeBSD.org> Date: Sat, 14 Oct 2017 16:52:18 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171014180305.GA75158@raichu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Oct 2017 03:54:17 -0000 On 10/14/2017 11:03, Mark Johnston wrote: > TAILQ_FOREACH_SAFE just fetches the next element at the beginning of > each loop iteration rather than at the end, same as the current > implementation of clear_unrhdr() does. There's no change to the code > generated by clang when I replace your loop with: > > TAILQ_FOREACH_SAFE(up, &uh->head, list, uq) { > if (up->ptr != uh) { > Free(up->ptr); > } > Free(up); > } Ah, that's a fair point... I was assuming Ngie was suggesting doing a TAILQ_REMOVE during each iteration, since that's probably the typical reason to do TAILQ_FOREACH_SAFE. That loop looks better. It would probably be good to change the queue(3) manpage to suggest that for deletion. Matt