From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751510AbdKLPCV (ORCPT ); Sun, 12 Nov 2017 10:02:21 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:34127 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253AbdKLPCU (ORCPT ); Sun, 12 Nov 2017 10:02:20 -0500 X-IronPort-AV: E=Sophos;i="5.44,384,1505772000"; d="scan'208";a="300442624" Date: Sun, 12 Nov 2017 16:02:18 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Masahiro Yamada cc: cocci@systeme.lip6.fr, Nicolas Palix , Gilles Muller , linux-kernel@vger.kernel.org, Michal Marek Subject: [PATCH] coccinelle: use exists to improve efficiency Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This just needs to find any reassignment of the loop iterator, and doesn't need such a thing on all execution paths, so use exists on the first rule. Signed-off-by: Julia Lawall --- diff --git a/scripts/coccinelle/iterators/list_entry_update.cocci b/scripts/coccinelle/iterators/list_entry_update.cocci index 873f444..be6f9f1 100644 --- a/scripts/coccinelle/iterators/list_entry_update.cocci +++ b/scripts/coccinelle/iterators/list_entry_update.cocci @@ -15,7 +15,7 @@ virtual context virtual org virtual report -@r@ +@r exists@ iterator name list_for_each_entry; expression x,E; position p1,p2;