From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C6E61203EA for ; Wed, 21 Dec 2016 07:36:08 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] searchthread: update comment about loop prevention Date: Wed, 21 Dec 2016 07:36:06 +0000 Message-Id: <20161221073607.32236-2-e@80x24.org> In-Reply-To: <20161221073607.32236-1-e@80x24.org> References: <20161221073607.32236-1-e@80x24.org> List-Id: It definitely is necessary to prevent looping with the %seen hash. --- lib/PublicInbox/SearchThread.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm index 601a84b..fafe7d7 100644 --- a/lib/PublicInbox/SearchThread.pm +++ b/lib/PublicInbox/SearchThread.pm @@ -129,7 +129,7 @@ sub add_child { sub has_descendent { my ($self, $child) = @_; - my %seen; # loop prevention XXX may not be necessary + my %seen; # loop prevention while ($child) { return 1 if $self == $child || $seen{$child}++; $child = $child->{parent}; -- EW